orionis 0.438.0__py3-none-any.whl → 0.439.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/container/context/scope.py +1 -1
- orionis/metadata/framework.py +1 -1
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/METADATA +1 -1
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/RECORD +23 -23
- tests/container/context/test_manager.py +1 -0
- tests/container/context/test_scope.py +1 -0
- tests/container/core/test_container.py +45 -1
- tests/container/core/test_singleton.py +5 -0
- tests/container/core/test_thread_safety.py +2 -0
- tests/container/validators/test_is_not_subclass.py +0 -1
- tests/foundation/config/queue/test_foundation_config_queue_brokers.py +1 -0
- tests/foundation/config/startup/test_foundation_config_startup.py +0 -1
- tests/services/environment/test_services_environment.py +5 -4
- tests/services/introspection/reflection/mock/fake_reflect_instance.py +750 -267
- tests/services/introspection/reflection/test_reflection_abstract.py +167 -92
- tests/services/introspection/reflection/test_reflection_callable.py +85 -35
- tests/services/introspection/reflection/test_reflection_concrete.py +345 -226
- tests/services/introspection/reflection/test_reflection_instance.py +627 -273
- tests/services/introspection/reflection/test_reflection_module.py +346 -175
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/WHEEL +0 -0
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/top_level.txt +0 -0
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/zip-safe +0 -0
orionis/metadata/framework.py
CHANGED
|
@@ -32,7 +32,7 @@ orionis/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
32
32
|
orionis/container/container.py,sha256=ICKSeaXA_IL15jV6Ofe1wIb1QyX-F-8oaGuk7hj955I,22773
|
|
33
33
|
orionis/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
orionis/container/context/manager.py,sha256=I08K_jKXSKmrq18Pv33qYyMKIlAovVOwIgmfiVm-J7c,2971
|
|
35
|
-
orionis/container/context/scope.py,sha256=
|
|
35
|
+
orionis/container/context/scope.py,sha256=_qwGMLV_zPVEvxESY18PCY8FS7AsSg_NlflwWGyOYOw,1143
|
|
36
36
|
orionis/container/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
37
|
orionis/container/contracts/container.py,sha256=QV_seo8mKrZJG2Ytr2u0RSiRaTaSPw6zUxgJ_tq6oP4,8301
|
|
38
38
|
orionis/container/contracts/resolver.py,sha256=cbzzLvUuv5FD8DHnjs8VGCjDnCHXPWezRPHS_qr93xs,3193
|
|
@@ -173,7 +173,7 @@ orionis/foundation/providers/progress_bar_provider.py,sha256=P__zpCyC29WCwErYGbh
|
|
|
173
173
|
orionis/foundation/providers/testing_provider.py,sha256=o47qiK8Xoz4hfsxw4jMnMxEbSseJFIdJT-WqxGurqGc,1426
|
|
174
174
|
orionis/foundation/providers/workers_provider.py,sha256=YMRLdq_YQnR1unnoYvDpYQZbLli04f0CckuR6Q--wKg,1379
|
|
175
175
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
176
|
-
orionis/metadata/framework.py,sha256=
|
|
176
|
+
orionis/metadata/framework.py,sha256=FNoJkM48YOODPNJmfzEHgP1ux9IcYWGQ6A-nz9dYJHY,4088
|
|
177
177
|
orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
|
|
178
178
|
orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
179
179
|
orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -341,16 +341,16 @@ orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNu
|
|
|
341
341
|
orionis/test/validators/workers.py,sha256=HcZ3cnrk6u7cvM1xZpn_lsglHAq69_jx9RcTSvLrdb0,1204
|
|
342
342
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
343
343
|
orionis/test/view/render.py,sha256=f-zNhtKSg9R5Njqujbg2l2amAs2-mRVESneLIkWOZjU,4082
|
|
344
|
-
orionis-0.
|
|
344
|
+
orionis-0.439.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
|
345
345
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
346
346
|
tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
347
347
|
tests/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
348
|
-
tests/container/context/test_manager.py,sha256=
|
|
349
|
-
tests/container/context/test_scope.py,sha256=
|
|
348
|
+
tests/container/context/test_manager.py,sha256=wOwXpl9rHNfTTexa9GBKYMwK0_-KSQPbI-AEyGNkmAE,1356
|
|
349
|
+
tests/container/context/test_scope.py,sha256=1YGfOHwOjLiQ1GPewbJGrUaTyH0SjrQux7LBVn_l2q4,1223
|
|
350
350
|
tests/container/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
351
|
-
tests/container/core/test_container.py,sha256=
|
|
352
|
-
tests/container/core/test_singleton.py,sha256=
|
|
353
|
-
tests/container/core/test_thread_safety.py,sha256
|
|
351
|
+
tests/container/core/test_container.py,sha256=6F4y5t-dR2E6eVKRI_hvKty0LhvTkXqiLGjaGVwsSb4,15775
|
|
352
|
+
tests/container/core/test_singleton.py,sha256=CfOB-YkIh16Pu5rNbOp5dD9cvMfWXHQESADDYSBcsQg,4801
|
|
353
|
+
tests/container/core/test_thread_safety.py,sha256=-GiscMxZJXr8vRiir_i7_6YtYqG9zDGo52druYk6qKo,3785
|
|
354
354
|
tests/container/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
355
355
|
tests/container/entities/test_binding.py,sha256=CFiBGlOeQKK4ielkj1JqxOWJSqrsi2VFIE7nE5R6ykU,9709
|
|
356
356
|
tests/container/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -370,7 +370,7 @@ tests/container/validators/test_is_abstract_class.py,sha256=_xW8NrnrmG5tKocaGs83
|
|
|
370
370
|
tests/container/validators/test_is_callable.py,sha256=VbQNKZ4sVQeWnqAIZ7R2E-6uFnT78Gcdaxf7Gq-qWlw,3767
|
|
371
371
|
tests/container/validators/test_is_concrete_class.py,sha256=bD8F_fbeWLf61I-7sCeapugvXl1-oSx8iVawuYF4tY4,6362
|
|
372
372
|
tests/container/validators/test_is_instance.py,sha256=skRLexi-31IxJrW0nSYwTW84iqXvi0IVqxHm0X-YfC0,5255
|
|
373
|
-
tests/container/validators/test_is_not_subclass.py,sha256=
|
|
373
|
+
tests/container/validators/test_is_not_subclass.py,sha256=8wemBngCqRC3WtXq0YwnEqLmllzYoKLCMd4pWg59350,1905
|
|
374
374
|
tests/container/validators/test_is_subclass.py,sha256=0Uc8uIR69ZX7G5Nrex0LMQXrueTdncdDxfQoila3h3U,5834
|
|
375
375
|
tests/container/validators/test_is_valid_alias.py,sha256=NA9QbIEh7n2_0GeVTMCppZG4_3ya4QrcvGI_lw1iJA8,5658
|
|
376
376
|
tests/container/validators/test_lifetime.py,sha256=5PequjXAcIcp0Q4TIki7THSU31XftGpI0u1mVGqHmpU,4692
|
|
@@ -417,14 +417,14 @@ tests/foundation/config/mail/test_foundation_config_mail_mailers.py,sha256=tcQ2E
|
|
|
417
417
|
tests/foundation/config/mail/test_foundation_config_mail_smtp.py,sha256=cf2gRJ0-IcqN38MhXIP_pfVjsRsRlCDOHPNB11B7daE,4883
|
|
418
418
|
tests/foundation/config/queue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
419
419
|
tests/foundation/config/queue/test_foundation_config_queue.py,sha256=1qeov00ibVDnH2C_M_T9yylMFL7pyhxxIqL852YXS54,2807
|
|
420
|
-
tests/foundation/config/queue/test_foundation_config_queue_brokers.py,sha256=
|
|
420
|
+
tests/foundation/config/queue/test_foundation_config_queue_brokers.py,sha256=pgdOtasyAkKOBscdb8T4GP5JeYRSBtGfpQIB4li0It8,2594
|
|
421
421
|
tests/foundation/config/queue/test_foundation_config_queue_database.py,sha256=qLYXjG8YVIp_NWYcZA9A2GmOdjFyt3snq9X1cdIok8M,4830
|
|
422
422
|
tests/foundation/config/root/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
423
423
|
tests/foundation/config/root/test_foundation_config_root_paths.py,sha256=_0jH-vuDH_4IEvGK1WSlZFTRpA6TIGbeofXjl9Kjz5U,3944
|
|
424
424
|
tests/foundation/config/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
425
425
|
tests/foundation/config/session/test_foundation_config_session.py,sha256=itTV_OxTsUUsS4AVvcrNntkuEmMPmEO6YZLjVLRwP50,7380
|
|
426
426
|
tests/foundation/config/startup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
427
|
-
tests/foundation/config/startup/test_foundation_config_startup.py,sha256=
|
|
427
|
+
tests/foundation/config/startup/test_foundation_config_startup.py,sha256=zI3tngsVSPLQ7Kjq5RUNuBZYPTCU-7w04c8rpSeQOUo,8022
|
|
428
428
|
tests/foundation/config/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
429
429
|
tests/foundation/config/testing/test_foundation_config_testing.py,sha256=YsXTVxq-S1KVlLK5fe2qL0CpQrulaLmy6sMSm3oPhbA,8237
|
|
430
430
|
tests/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -434,7 +434,7 @@ tests/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
434
434
|
tests/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
435
435
|
tests/services/asynchrony/test_services_asynchrony_coroutine.py,sha256=34Y0D6w2bVo_dm3oj0wzedMIJuSYieUG9Y2J1EQmZeo,3439
|
|
436
436
|
tests/services/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
437
|
-
tests/services/environment/test_services_environment.py,sha256=
|
|
437
|
+
tests/services/environment/test_services_environment.py,sha256=8gbF2vK238lracBipHCHgiYxThRnfLtN9pj--rFald0,9570
|
|
438
438
|
tests/services/introspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
439
439
|
tests/services/introspection/test_reflection.py,sha256=AaBi0zi7GphOqnagV8N48GZHUuoT7743Pw3oc6_As6I,13700
|
|
440
440
|
tests/services/introspection/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -444,13 +444,13 @@ tests/services/introspection/dependencies/mocks/mock_user.py,sha256=RxATxe0-Vm4H
|
|
|
444
444
|
tests/services/introspection/dependencies/mocks/mock_user_controller.py,sha256=Hu4Xys5HENpKaLqsEAjtp_C-M9y6ozmJ_-qmj3ZvK6c,1214
|
|
445
445
|
tests/services/introspection/dependencies/mocks/mock_users_permissions.py,sha256=oENXbS2qmQUudYSmnhB8fgHBqXZdbplplB-Y2nbx4hw,1388
|
|
446
446
|
tests/services/introspection/reflection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
447
|
-
tests/services/introspection/reflection/test_reflection_abstract.py,sha256=
|
|
448
|
-
tests/services/introspection/reflection/test_reflection_callable.py,sha256=
|
|
449
|
-
tests/services/introspection/reflection/test_reflection_concrete.py,sha256=
|
|
450
|
-
tests/services/introspection/reflection/test_reflection_instance.py,sha256=
|
|
451
|
-
tests/services/introspection/reflection/test_reflection_module.py,sha256=
|
|
447
|
+
tests/services/introspection/reflection/test_reflection_abstract.py,sha256=mP5kCwmc5fau6ZUN-h19urZSZGIKk7fAuokniF5vD_Q,42319
|
|
448
|
+
tests/services/introspection/reflection/test_reflection_callable.py,sha256=4FaMBFfFh3T-MVvBmHCY6Z-xo5i3gVKZwP-_kTxHaCQ,6828
|
|
449
|
+
tests/services/introspection/reflection/test_reflection_concrete.py,sha256=H3wrXf2oW6NMj50RlYngIyoGECTXJeOy_FXWIJfKxzY,39064
|
|
450
|
+
tests/services/introspection/reflection/test_reflection_instance.py,sha256=CUNNId0B13sfHhN6bFW2Z4xKNJO5GN3K9l_VfX1LO4c,58019
|
|
451
|
+
tests/services/introspection/reflection/test_reflection_module.py,sha256=a4sjSHeKADHUO5FvSDg1wPYNGfO385JZxSCoIqjfuZE,24608
|
|
452
452
|
tests/services/introspection/reflection/mock/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
453
|
-
tests/services/introspection/reflection/mock/fake_reflect_instance.py,sha256=
|
|
453
|
+
tests/services/introspection/reflection/mock/fake_reflect_instance.py,sha256=iMf_yKgk0Y91XUHhRcl2qw7Z83QeNspvLi_tl4Dp-rI,28032
|
|
454
454
|
tests/services/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
455
455
|
tests/services/log/test_log.py,sha256=fCI2gX9-YN1z-xPMwIlggUFHeBlqfUajQoyQu4dmao0,2868
|
|
456
456
|
tests/services/path/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -487,8 +487,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
487
487
|
tests/testing/validators/test_testing_validators.py,sha256=WPo5GxTP6xE-Dw3X1vZoqOMpb6HhokjNSbgDsDRDvy4,16588
|
|
488
488
|
tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
489
489
|
tests/testing/view/test_render.py,sha256=tnnMBwS0iKUIbogLvu-7Rii50G6Koddp3XT4wgdFEYM,1050
|
|
490
|
-
orionis-0.
|
|
491
|
-
orionis-0.
|
|
492
|
-
orionis-0.
|
|
493
|
-
orionis-0.
|
|
494
|
-
orionis-0.
|
|
490
|
+
orionis-0.439.0.dist-info/METADATA,sha256=fYNFIu7-QX1wwnyjXbMHE92LUOgek0F6T2PQ32oqx9o,4772
|
|
491
|
+
orionis-0.439.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
492
|
+
orionis-0.439.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
|
493
|
+
orionis-0.439.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
494
|
+
orionis-0.439.0.dist-info/RECORD,,
|
|
@@ -18,6 +18,7 @@ class TestScopeManagerMethods(AsyncTestCase):
|
|
|
18
18
|
This method does not return any value. It asserts the existence of methods
|
|
19
19
|
and fails the test if any are missing.
|
|
20
20
|
"""
|
|
21
|
+
|
|
21
22
|
# List of expected method names in ScopeManager
|
|
22
23
|
expected_methods = [
|
|
23
24
|
"__init__",
|
|
@@ -16,6 +16,7 @@ class TestScopedContextMethods(AsyncTestCase):
|
|
|
16
16
|
None
|
|
17
17
|
This method does not return anything. It asserts the existence of methods and fails the test if any are missing.
|
|
18
18
|
"""
|
|
19
|
+
|
|
19
20
|
# List of method names expected to be present in ScopedContext
|
|
20
21
|
expected_methods = [
|
|
21
22
|
"getCurrentScope",
|
|
@@ -29,9 +29,13 @@ class TestContainer(AsyncTestCase):
|
|
|
29
29
|
-----
|
|
30
30
|
After the test, the registration for `ICar` is dropped from the container to clean up.
|
|
31
31
|
"""
|
|
32
|
+
|
|
33
|
+
# Create a new container instance
|
|
32
34
|
container = Container()
|
|
35
|
+
|
|
33
36
|
# Register ICar as a transient binding to Car
|
|
34
37
|
container.transient(ICar, Car)
|
|
38
|
+
|
|
35
39
|
# Resolve two instances of ICar (should be different objects)
|
|
36
40
|
instance1 = container.make(ICar)
|
|
37
41
|
instance2 = container.make(ICar)
|
|
@@ -39,6 +43,7 @@ class TestContainer(AsyncTestCase):
|
|
|
39
43
|
# Assert both instances are of type Car
|
|
40
44
|
self.assertIsInstance(instance1, Car)
|
|
41
45
|
self.assertIsInstance(instance2, Car)
|
|
46
|
+
|
|
42
47
|
# Assert that the instances are not the same object (transient behavior)
|
|
43
48
|
self.assertIsNot(instance1, instance2)
|
|
44
49
|
|
|
@@ -68,9 +73,13 @@ class TestContainer(AsyncTestCase):
|
|
|
68
73
|
-----
|
|
69
74
|
The registration for `ICar` is dropped after the test.
|
|
70
75
|
"""
|
|
76
|
+
|
|
77
|
+
# Create a new container instance
|
|
71
78
|
container = Container()
|
|
79
|
+
|
|
72
80
|
# Register ICar as a singleton binding to Car
|
|
73
81
|
container.singleton(ICar, Car)
|
|
82
|
+
|
|
74
83
|
# Resolve two instances of ICar (should be the same object)
|
|
75
84
|
instance1 = container.make(ICar)
|
|
76
85
|
instance2 = container.make(ICar)
|
|
@@ -78,6 +87,7 @@ class TestContainer(AsyncTestCase):
|
|
|
78
87
|
# Assert both instances are of type Car
|
|
79
88
|
self.assertIsInstance(instance1, Car)
|
|
80
89
|
self.assertIsInstance(instance2, Car)
|
|
90
|
+
|
|
81
91
|
# Assert that both instances are the same object (singleton behavior)
|
|
82
92
|
self.assertIs(instance1, instance2)
|
|
83
93
|
|
|
@@ -106,7 +116,10 @@ class TestContainer(AsyncTestCase):
|
|
|
106
116
|
-----
|
|
107
117
|
The registration for `ICar` is dropped after the test.
|
|
108
118
|
"""
|
|
119
|
+
|
|
120
|
+
# Create a new container instance
|
|
109
121
|
container = Container()
|
|
122
|
+
|
|
110
123
|
# First context: instances should be the same
|
|
111
124
|
with container.createContext():
|
|
112
125
|
container.scoped(ICar, Car)
|
|
@@ -147,13 +160,16 @@ class TestContainer(AsyncTestCase):
|
|
|
147
160
|
-----
|
|
148
161
|
The registration for `ICar` is dropped after the test.
|
|
149
162
|
"""
|
|
163
|
+
|
|
164
|
+
# Create a specific instance of Car
|
|
150
165
|
car_instance = Car()
|
|
151
166
|
container = Container()
|
|
167
|
+
|
|
152
168
|
# Register a specific instance of Car to ICar
|
|
153
169
|
container.instance(ICar, car_instance)
|
|
170
|
+
|
|
154
171
|
# Resolve ICar and check that it returns the same instance
|
|
155
172
|
resolved = container.make(ICar)
|
|
156
|
-
|
|
157
173
|
self.assertIs(resolved, car_instance)
|
|
158
174
|
|
|
159
175
|
# Clean up registration
|
|
@@ -182,13 +198,19 @@ class TestContainer(AsyncTestCase):
|
|
|
182
198
|
-----
|
|
183
199
|
The registrations for 'add' and 'multiply' are dropped after the test.
|
|
184
200
|
"""
|
|
201
|
+
|
|
202
|
+
# Define some simple functions to register
|
|
185
203
|
def add(a: int, b: int) -> int:
|
|
186
204
|
return a + b
|
|
187
205
|
|
|
206
|
+
|
|
207
|
+
# Define another function to register
|
|
188
208
|
def multiply(a: int, b: int) -> int:
|
|
189
209
|
return a * b
|
|
190
210
|
|
|
211
|
+
# Create a new container instance
|
|
191
212
|
container = Container()
|
|
213
|
+
|
|
192
214
|
# Register callables
|
|
193
215
|
container.callable('add', add)
|
|
194
216
|
container.callable('multiply', multiply)
|
|
@@ -225,10 +247,14 @@ class TestContainer(AsyncTestCase):
|
|
|
225
247
|
-----
|
|
226
248
|
The registration for `ICar` is dropped after the test.
|
|
227
249
|
"""
|
|
250
|
+
|
|
251
|
+
# Create a new container instance
|
|
228
252
|
container = Application()
|
|
253
|
+
|
|
229
254
|
# Register ICar as a transient binding to Car
|
|
230
255
|
container.transient(ICar, Car)
|
|
231
256
|
|
|
257
|
+
# Define a Facade class to access the ICar binding
|
|
232
258
|
class CarFacade(Facade):
|
|
233
259
|
@classmethod
|
|
234
260
|
def getFacadeAccessor(cls):
|
|
@@ -269,10 +295,14 @@ class TestContainer(AsyncTestCase):
|
|
|
269
295
|
-----
|
|
270
296
|
The registration for `ICar` is dropped after the test.
|
|
271
297
|
"""
|
|
298
|
+
|
|
299
|
+
# Create a new container instance
|
|
272
300
|
container = Application()
|
|
301
|
+
|
|
273
302
|
# Register ICar as a singleton binding to Car
|
|
274
303
|
container.singleton(ICar, Car)
|
|
275
304
|
|
|
305
|
+
# Define a Facade class to access the ICar binding
|
|
276
306
|
class CarFacade(Facade):
|
|
277
307
|
@classmethod
|
|
278
308
|
def getFacadeAccessor(cls):
|
|
@@ -282,6 +312,7 @@ class TestContainer(AsyncTestCase):
|
|
|
282
312
|
instance1 = CarFacade.resolve()
|
|
283
313
|
instance2 = CarFacade.resolve()
|
|
284
314
|
|
|
315
|
+
# Assert both instances are of type Car and are the same object
|
|
285
316
|
self.assertIsInstance(instance1, Car)
|
|
286
317
|
self.assertIsInstance(instance2, Car)
|
|
287
318
|
self.assertIs(instance1, instance2)
|
|
@@ -312,12 +343,17 @@ class TestContainer(AsyncTestCase):
|
|
|
312
343
|
-----
|
|
313
344
|
The registration for `ICar` is dropped after the test.
|
|
314
345
|
"""
|
|
346
|
+
|
|
347
|
+
# Create a new container instance
|
|
315
348
|
container = Application()
|
|
349
|
+
|
|
316
350
|
# Create a new scope/context
|
|
317
351
|
with container.createContext():
|
|
352
|
+
|
|
318
353
|
# Register ICar as a scoped binding to Car
|
|
319
354
|
container.scoped(ICar, Car)
|
|
320
355
|
|
|
356
|
+
# Define a Facade class to access the ICar binding
|
|
321
357
|
class CarFacade(Facade):
|
|
322
358
|
@classmethod
|
|
323
359
|
def getFacadeAccessor(cls):
|
|
@@ -327,6 +363,7 @@ class TestContainer(AsyncTestCase):
|
|
|
327
363
|
instance1 = CarFacade.resolve()
|
|
328
364
|
instance2 = CarFacade.resolve()
|
|
329
365
|
|
|
366
|
+
# Assert both instances are of type Car and are the same object
|
|
330
367
|
self.assertIsInstance(instance1, Car)
|
|
331
368
|
self.assertIsInstance(instance2, Car)
|
|
332
369
|
self.assertIs(instance1, instance2)
|
|
@@ -357,7 +394,10 @@ class TestContainer(AsyncTestCase):
|
|
|
357
394
|
Exception
|
|
358
395
|
Raised when attempting to resolve an unregistered type.
|
|
359
396
|
"""
|
|
397
|
+
|
|
398
|
+
# Create a new container instance
|
|
360
399
|
container = Container()
|
|
400
|
+
|
|
361
401
|
# Attempt to resolve an unregistered type; should raise Exception
|
|
362
402
|
with self.assertRaises(Exception):
|
|
363
403
|
container.make('ICar')
|
|
@@ -386,13 +426,17 @@ class TestContainer(AsyncTestCase):
|
|
|
386
426
|
-----
|
|
387
427
|
The registration for `ICar` is dropped after the test.
|
|
388
428
|
"""
|
|
429
|
+
|
|
430
|
+
# Create a new container instance
|
|
389
431
|
class SportsCar(Car):
|
|
390
432
|
def start(self):
|
|
391
433
|
return f"{self.brand} {self.model} is starting."
|
|
392
434
|
def stop(self):
|
|
393
435
|
return f"{self.brand} {self.model} is stopping."
|
|
394
436
|
|
|
437
|
+
# Create a new container instance
|
|
395
438
|
container = Container()
|
|
439
|
+
|
|
396
440
|
# Register ICar as a singleton binding to Car
|
|
397
441
|
container.singleton(ICar, Car)
|
|
398
442
|
first = container.make(ICar)
|
|
@@ -20,6 +20,7 @@ class TestSingleton(AsyncTestCase):
|
|
|
20
20
|
None
|
|
21
21
|
This method does not return any value. Assertions are used to validate singleton behavior.
|
|
22
22
|
"""
|
|
23
|
+
|
|
23
24
|
# Create multiple instances of Container and Orionis
|
|
24
25
|
container1 = Container()
|
|
25
26
|
container2 = Container()
|
|
@@ -49,6 +50,8 @@ class TestSingleton(AsyncTestCase):
|
|
|
49
50
|
None
|
|
50
51
|
This method does not return any value. Assertions are used to validate thread-safe singleton behavior.
|
|
51
52
|
"""
|
|
53
|
+
|
|
54
|
+
# List to hold instances created in threads
|
|
52
55
|
container_instances = []
|
|
53
56
|
orionis_instances = []
|
|
54
57
|
|
|
@@ -101,6 +104,8 @@ class TestSingleton(AsyncTestCase):
|
|
|
101
104
|
None
|
|
102
105
|
This method does not return any value. Assertions are used to validate singleton separation.
|
|
103
106
|
"""
|
|
107
|
+
|
|
108
|
+
# Create instances of Container and Orionis
|
|
104
109
|
container = Container()
|
|
105
110
|
orionis = Orionis()
|
|
106
111
|
|
|
@@ -32,6 +32,8 @@ class TestThreadSafety(AsyncTestCase):
|
|
|
32
32
|
- ThreadPoolExecutor is used to simulate high concurrency.
|
|
33
33
|
- The test ensures that singleton integrity is maintained even under heavy load.
|
|
34
34
|
"""
|
|
35
|
+
|
|
36
|
+
# Create lists to hold instances created in threads
|
|
35
37
|
container_instances = []
|
|
36
38
|
orionis_instances = []
|
|
37
39
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from abc import ABC
|
|
2
2
|
from orionis.container.validators.is_not_subclass import IsNotSubclass
|
|
3
|
-
from orionis.container.exceptions.exception import OrionisContainerException
|
|
4
3
|
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
5
4
|
|
|
6
5
|
class TestIsNotSubclass(AsyncTestCase):
|
|
@@ -4,6 +4,7 @@ from orionis.foundation.exceptions.integrity import OrionisIntegrityException
|
|
|
4
4
|
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
5
5
|
|
|
6
6
|
class TestFoundationConfigQueueBrokers(AsyncTestCase):
|
|
7
|
+
|
|
7
8
|
async def testDefaultInitialization(self):
|
|
8
9
|
"""
|
|
9
10
|
Test that Brokers instance is initialized with correct default values.
|
|
@@ -14,7 +14,6 @@ from orionis.foundation.config.queue.entities.queue import Queue
|
|
|
14
14
|
from orionis.foundation.config.session.entities.session import Session
|
|
15
15
|
from orionis.foundation.config.testing.entities.testing import Testing
|
|
16
16
|
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
17
|
-
from unittest.mock import Mock
|
|
18
17
|
|
|
19
18
|
class TestFoundationConfigStartup(AsyncTestCase):
|
|
20
19
|
"""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import os
|
|
2
1
|
from orionis.services.environment.core.dot_env import DotEnv
|
|
3
2
|
from orionis.services.environment.env import Env
|
|
4
3
|
from orionis.services.environment.enums.value_type import EnvironmentValueType
|
|
4
|
+
from orionis.services.environment.key.key_generator import SecureKeyGenerator
|
|
5
5
|
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
6
6
|
|
|
7
7
|
class TestServicesEnvironment(AsyncTestCase):
|
|
@@ -152,7 +152,7 @@ class TestServicesEnvironment(AsyncTestCase):
|
|
|
152
152
|
self.assertEqual(env.get("CAST_EXAMPLE_SET"), {1, 2, 3})
|
|
153
153
|
|
|
154
154
|
# Set and assert a base64 value with explicit type
|
|
155
|
-
ramdon_text =
|
|
155
|
+
ramdon_text = SecureKeyGenerator.generate()
|
|
156
156
|
env.set("CAST_EXAMPLE_BASE64", ramdon_text, EnvironmentValueType.BASE64)
|
|
157
157
|
self.assertEqual(env.get("CAST_EXAMPLE_BASE64"), ramdon_text)
|
|
158
158
|
|
|
@@ -221,5 +221,6 @@ class TestServicesEnvironment(AsyncTestCase):
|
|
|
221
221
|
self.assertEqual(env.get("EXAMPLE_SET"), {1, 2, 3})
|
|
222
222
|
|
|
223
223
|
# Set and get a base64 value without explicit type
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
ramdon_text = SecureKeyGenerator.generate()
|
|
225
|
+
env.set("EXAMPLE_BASE64", ramdon_text)
|
|
226
|
+
self.assertEqual(env.get("EXAMPLE_BASE64"), ramdon_text)
|