orionis 0.449.0__py3-none-any.whl → 0.451.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/console/base/contracts/command.py +0 -2
- orionis/console/core/__init__.py +0 -0
- orionis/container/container.py +1620 -88
- orionis/container/context/scope.py +1 -1
- orionis/container/contracts/container.py +184 -33
- orionis/foundation/config/database/entities/mysql.py +0 -1
- orionis/metadata/framework.py +1 -1
- orionis/services/inspirational/contracts/__init__.py +0 -0
- orionis/services/introspection/abstract/contracts/reflection.py +5 -6
- orionis/services/introspection/abstract/reflection.py +5 -6
- orionis/services/introspection/callables/contracts/reflection.py +3 -2
- orionis/services/introspection/callables/reflection.py +4 -4
- orionis/services/introspection/concretes/contracts/reflection.py +5 -6
- orionis/services/introspection/concretes/reflection.py +5 -6
- orionis/services/introspection/dependencies/contracts/reflection.py +87 -23
- orionis/services/introspection/dependencies/entities/argument.py +95 -0
- orionis/services/introspection/dependencies/entities/resolve_argument.py +82 -0
- orionis/services/introspection/dependencies/reflection.py +176 -106
- orionis/services/introspection/instances/contracts/reflection.py +5 -6
- orionis/services/introspection/instances/reflection.py +5 -6
- orionis/test/core/unit_test.py +150 -48
- {orionis-0.449.0.dist-info → orionis-0.451.0.dist-info}/METADATA +1 -1
- {orionis-0.449.0.dist-info → orionis-0.451.0.dist-info}/RECORD +35 -38
- tests/container/mocks/mock_auto_resolution.py +192 -0
- tests/services/introspection/dependencies/test_reflect_dependencies.py +135 -58
- tests/services/introspection/reflection/test_reflection_abstract.py +5 -4
- tests/services/introspection/reflection/test_reflection_callable.py +3 -3
- tests/services/introspection/reflection/test_reflection_concrete.py +4 -4
- tests/services/introspection/reflection/test_reflection_instance.py +5 -5
- orionis/console/args/parser.py +0 -40
- orionis/container/contracts/resolver.py +0 -115
- orionis/container/resolver/resolver.py +0 -602
- orionis/services/introspection/dependencies/entities/callable_dependencies.py +0 -54
- orionis/services/introspection/dependencies/entities/class_dependencies.py +0 -61
- orionis/services/introspection/dependencies/entities/known_dependencies.py +0 -67
- orionis/services/introspection/dependencies/entities/method_dependencies.py +0 -61
- tests/container/resolver/test_resolver.py +0 -62
- /orionis/{container/resolver → console/commands}/__init__.py +0 -0
- {tests/container/resolver → orionis/console/contracts}/__init__.py +0 -0
- {orionis-0.449.0.dist-info → orionis-0.451.0.dist-info}/WHEEL +0 -0
- {orionis-0.449.0.dist-info → orionis-0.451.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.449.0.dist-info → orionis-0.451.0.dist-info}/top_level.txt +0 -0
- {orionis-0.449.0.dist-info → orionis-0.451.0.dist-info}/zip-safe +0 -0
orionis/test/core/unit_test.py
CHANGED
|
@@ -11,7 +11,6 @@ from datetime import datetime
|
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from typing import Any, Dict, List, Optional, Tuple
|
|
13
13
|
from orionis.app import Orionis
|
|
14
|
-
from orionis.container.resolver.resolver import Resolver
|
|
15
14
|
from orionis.foundation.config.testing.enums.drivers import PersistentDrivers
|
|
16
15
|
from orionis.foundation.config.testing.enums.mode import ExecutionMode
|
|
17
16
|
from orionis.foundation.config.testing.enums.verbosity import VerbosityMode
|
|
@@ -620,6 +619,114 @@ class UnitTest(IUnitTest):
|
|
|
620
619
|
# Return the result, output, and error buffers
|
|
621
620
|
return result, output_buffer, error_buffer
|
|
622
621
|
|
|
622
|
+
def __isFailedImport(
|
|
623
|
+
self,
|
|
624
|
+
test_case: unittest.TestCase
|
|
625
|
+
) -> bool:
|
|
626
|
+
"""
|
|
627
|
+
Check if the given test case is a failed import.
|
|
628
|
+
|
|
629
|
+
Parameters
|
|
630
|
+
----------
|
|
631
|
+
test_case : unittest.TestCase
|
|
632
|
+
The test case to check.
|
|
633
|
+
|
|
634
|
+
Returns
|
|
635
|
+
-------
|
|
636
|
+
bool
|
|
637
|
+
True if the test case is a failed import, False otherwise.
|
|
638
|
+
"""
|
|
639
|
+
|
|
640
|
+
return test_case.__class__.__name__ == "_FailedTest"
|
|
641
|
+
|
|
642
|
+
def __notFoundTestMethod(
|
|
643
|
+
self,
|
|
644
|
+
test_case: unittest.TestCase
|
|
645
|
+
) -> bool:
|
|
646
|
+
"""
|
|
647
|
+
Check if the test case does not have a valid test method.
|
|
648
|
+
|
|
649
|
+
Parameters
|
|
650
|
+
----------
|
|
651
|
+
test_case : unittest.TestCase
|
|
652
|
+
The test case to check.
|
|
653
|
+
|
|
654
|
+
Returns
|
|
655
|
+
-------
|
|
656
|
+
bool
|
|
657
|
+
True if the test case does not have a valid test method, False otherwise.
|
|
658
|
+
"""
|
|
659
|
+
|
|
660
|
+
# Use reflection to get the test method name
|
|
661
|
+
rf_instance = ReflectionInstance(test_case)
|
|
662
|
+
method_name = rf_instance.getAttribute("_testMethodName")
|
|
663
|
+
|
|
664
|
+
# If no method name is found, return True indicating no valid test method
|
|
665
|
+
return not method_name or not hasattr(test_case.__class__, method_name)
|
|
666
|
+
|
|
667
|
+
def __isDecoratedMethod(
|
|
668
|
+
self,
|
|
669
|
+
test_case: unittest.TestCase
|
|
670
|
+
) -> bool:
|
|
671
|
+
"""
|
|
672
|
+
Determine if the test case's test method is decorated (wrapped by decorators).
|
|
673
|
+
|
|
674
|
+
This method examines the test method of a given test case to determine if it has been
|
|
675
|
+
decorated with one or more Python decorators. It traverses the decorator chain by
|
|
676
|
+
following the `__wrapped__` attribute to identify the presence of any decorators.
|
|
677
|
+
Decorated methods typically have a `__wrapped__` attribute that points to the
|
|
678
|
+
original unwrapped function.
|
|
679
|
+
|
|
680
|
+
Parameters
|
|
681
|
+
----------
|
|
682
|
+
test_case : unittest.TestCase
|
|
683
|
+
The test case instance whose test method will be examined for decorators.
|
|
684
|
+
|
|
685
|
+
Returns
|
|
686
|
+
-------
|
|
687
|
+
bool
|
|
688
|
+
True if the test method has one or more decorators applied to it, False if
|
|
689
|
+
the test method is not decorated or if no test method is found.
|
|
690
|
+
|
|
691
|
+
Notes
|
|
692
|
+
-----
|
|
693
|
+
This method checks for decorators by examining the `__wrapped__` attribute chain.
|
|
694
|
+
The method collects decorator names from `__qualname__` or `__name__` attributes
|
|
695
|
+
as it traverses the wrapper chain. If any decorators are found in the chain,
|
|
696
|
+
the method returns True.
|
|
697
|
+
"""
|
|
698
|
+
|
|
699
|
+
# Retrieve the test method from the test case's class using the test method name
|
|
700
|
+
test_method = getattr(test_case.__class__, getattr(test_case, "_testMethodName"), None)
|
|
701
|
+
|
|
702
|
+
# Initialize a list to store decorator information found during traversal
|
|
703
|
+
decorators = []
|
|
704
|
+
|
|
705
|
+
# Check if the method has the __wrapped__ attribute, indicating it's decorated
|
|
706
|
+
if hasattr(test_method, '__wrapped__'):
|
|
707
|
+
# Start with the outermost decorated method
|
|
708
|
+
original = test_method
|
|
709
|
+
|
|
710
|
+
# Traverse the decorator chain by following __wrapped__ attributes
|
|
711
|
+
while hasattr(original, '__wrapped__'):
|
|
712
|
+
# Collect decorator name information for tracking purposes
|
|
713
|
+
if hasattr(original, '__qualname__'):
|
|
714
|
+
# Prefer __qualname__ as it provides more detailed naming information
|
|
715
|
+
decorators.append(original.__qualname__)
|
|
716
|
+
elif hasattr(original, '__name__'):
|
|
717
|
+
# Fall back to __name__ if __qualname__ is not available
|
|
718
|
+
decorators.append(original.__name__)
|
|
719
|
+
|
|
720
|
+
# Move to the next level in the decorator chain
|
|
721
|
+
original = original.__wrapped__
|
|
722
|
+
|
|
723
|
+
# Return True if any decorators were found during the traversal
|
|
724
|
+
if decorators:
|
|
725
|
+
return True
|
|
726
|
+
|
|
727
|
+
# Return False if no decorators are found or if the method is not decorated
|
|
728
|
+
return False
|
|
729
|
+
|
|
623
730
|
def __resolveFlattenedTestSuite(
|
|
624
731
|
self
|
|
625
732
|
) -> unittest.TestSuite:
|
|
@@ -649,71 +756,66 @@ class UnitTest(IUnitTest):
|
|
|
649
756
|
for test_case in self.__flattenTestSuite(self.__suite):
|
|
650
757
|
|
|
651
758
|
# If the test case is a failed import, add it directly
|
|
652
|
-
if test_case
|
|
759
|
+
if self.__isFailedImport(test_case):
|
|
653
760
|
flattened_suite.addTest(test_case)
|
|
654
761
|
continue
|
|
655
762
|
|
|
656
|
-
# Use reflection to get the test method name
|
|
657
|
-
rf_instance = ReflectionInstance(test_case)
|
|
658
|
-
method_name = rf_instance.getAttribute("_testMethodName")
|
|
659
|
-
|
|
660
763
|
# If no method name is found, add the test case as-is
|
|
661
|
-
if
|
|
764
|
+
if self.__notFoundTestMethod(test_case):
|
|
662
765
|
flattened_suite.addTest(test_case)
|
|
663
766
|
continue
|
|
664
767
|
|
|
665
|
-
# Retrieve the test method from the class
|
|
666
|
-
test_method = getattr(test_case.__class__, method_name, None)
|
|
667
|
-
|
|
668
|
-
# Check if the method is decorated (wrapped)
|
|
669
|
-
decorators = []
|
|
670
|
-
if hasattr(test_method, '__wrapped__'):
|
|
671
|
-
original = test_method
|
|
672
|
-
while hasattr(original, '__wrapped__'):
|
|
673
|
-
if hasattr(original, '__qualname__'):
|
|
674
|
-
decorators.append(original.__qualname__)
|
|
675
|
-
elif hasattr(original, '__name__'):
|
|
676
|
-
decorators.append(original.__name__)
|
|
677
|
-
original = original.__wrapped__
|
|
678
|
-
|
|
679
768
|
# If decorators are present, add the test case as-is
|
|
680
|
-
if
|
|
769
|
+
if self.__isDecoratedMethod(test_case):
|
|
681
770
|
flattened_suite.addTest(test_case)
|
|
682
771
|
continue
|
|
683
772
|
|
|
684
|
-
|
|
685
|
-
signature = rf_instance.getMethodDependencies(method_name)
|
|
773
|
+
try:
|
|
686
774
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
775
|
+
# Get the method's dependency signature
|
|
776
|
+
rf_instance = ReflectionInstance(test_case)
|
|
777
|
+
dependencies = rf_instance.getMethodDependencies(
|
|
778
|
+
method_name=getattr(test_case, "_testMethodName")
|
|
779
|
+
)
|
|
691
780
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
781
|
+
# If no dependencies are required or unresolved, add the test case as-is
|
|
782
|
+
if ((not dependencies.resolved and not dependencies.unresolved) or (not dependencies.resolved and len(dependencies.unresolved) > 0)):
|
|
783
|
+
flattened_suite.addTest(test_case)
|
|
784
|
+
continue
|
|
785
|
+
|
|
786
|
+
# If there are unresolved dependencies, raise an error
|
|
787
|
+
if (len(dependencies.unresolved) > 0):
|
|
788
|
+
raise OrionisTestValueError(
|
|
789
|
+
f"Test method '{getattr(test_case, "_testMethodName")}' in class '{test_case.__class__.__name__}' has unresolved dependencies: {dependencies.unresolved}. "
|
|
790
|
+
"Please ensure all dependencies are correctly defined and available."
|
|
791
|
+
)
|
|
792
|
+
|
|
793
|
+
# Get the original test class and method
|
|
794
|
+
test_class = rf_instance.getClass()
|
|
795
|
+
original_method = getattr(test_class, getattr(test_case, "_testMethodName"))
|
|
796
|
+
|
|
797
|
+
# Resolve the dependencies using the application's resolver
|
|
798
|
+
params = self.__app.resolveDependencyArguments(
|
|
799
|
+
rf_instance.getClassName(),
|
|
800
|
+
dependencies
|
|
697
801
|
)
|
|
698
802
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
803
|
+
# Create a wrapper to inject resolved dependencies into the test method
|
|
804
|
+
def create_test_wrapper(original_test, resolved_args: dict):
|
|
805
|
+
def wrapper(self_instance):
|
|
806
|
+
return original_test(self_instance, **resolved_args)
|
|
807
|
+
return wrapper
|
|
702
808
|
|
|
703
|
-
|
|
704
|
-
|
|
809
|
+
# Bind the wrapped method to the test case instance
|
|
810
|
+
wrapped_method = create_test_wrapper(original_method, params)
|
|
811
|
+
bound_method = wrapped_method.__get__(test_case, test_case.__class__)
|
|
812
|
+
setattr(test_case, getattr(test_case, "_testMethodName"), bound_method)
|
|
813
|
+
flattened_suite.addTest(test_case)
|
|
705
814
|
|
|
706
|
-
|
|
707
|
-
def create_test_wrapper(original_test, resolved_args: dict):
|
|
708
|
-
def wrapper(self_instance):
|
|
709
|
-
return original_test(self_instance, **resolved_args)
|
|
710
|
-
return wrapper
|
|
815
|
+
except Exception as e:
|
|
711
816
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
bound_method = wrapped_method.__get__(test_case, test_case.__class__)
|
|
715
|
-
setattr(test_case, method_name, bound_method)
|
|
716
|
-
flattened_suite.addTest(test_case)
|
|
817
|
+
# If dependency resolution fails, add the original test case
|
|
818
|
+
flattened_suite.addTest(test_case)
|
|
717
819
|
|
|
718
820
|
return flattened_suite
|
|
719
821
|
|
|
@@ -4,15 +4,17 @@ orionis/console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
4
4
|
orionis/console/kernel.py,sha256=1CuBCLR6KItRt0_m50YQXirJUMX6lJf4Z4vvOjBqaUU,856
|
|
5
5
|
orionis/console/args/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
orionis/console/args/argument.py,sha256=Is8Z8_kW4DvcK1nK1UU-sa6Pk0BeOdcRczCayW0ZVHc,20360
|
|
7
|
-
orionis/console/args/parser.py,sha256=3eHQnYW-owS2n87T8M-DNKsf5vJTj7MZgar7DNF8DEw,1022
|
|
8
7
|
orionis/console/args/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
8
|
orionis/console/args/enums/actions.py,sha256=S3T-vWS6DJSGtANrq3od3-90iYAjPvJwaOZ2V02y34c,1222
|
|
10
9
|
orionis/console/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
10
|
orionis/console/base/command.py,sha256=nasVPyKEvuv8sDFEWXhHyBCWAmSLfPPm2XlKaYYt_pM,6642
|
|
12
11
|
orionis/console/base/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
orionis/console/base/contracts/command.py,sha256=
|
|
12
|
+
orionis/console/base/contracts/command.py,sha256=vmAJD0yMQ5-AD_s9_xCFEAl64sKk65z7U2E196dALQM,5760
|
|
13
|
+
orionis/console/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
orionis/console/commands/version.py,sha256=kR8xzyc-Wisk7AXqg3Do7M9xTg_CxJgAtESPGrbRtpI,1673
|
|
15
|
+
orionis/console/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
16
|
orionis/console/contracts/kernel.py,sha256=mh4LlhEYHh3FuGZZQ0GBhD6ZLa5YQvaNj2r01IIHI5Y,826
|
|
17
|
+
orionis/console/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
18
|
orionis/console/core/reactor.py,sha256=oal0RcDvZgZDqIHDeQ0PT1U9bEKjN6DBopob4yBZ1bc,18073
|
|
17
19
|
orionis/console/dumper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
20
|
orionis/console/dumper/dump.py,sha256=CATERiQ6XuIrKQsDaWcVxzTtlAJI9qLJX44fQxEX8ws,22443
|
|
@@ -36,13 +38,12 @@ orionis/console/output/contracts/executor.py,sha256=7l3kwnvv6GlH9EYk0v94YE1olex_
|
|
|
36
38
|
orionis/console/output/enums/__init__.py,sha256=LAaAxg-DpArCjf_jqZ0_9s3p8899gntDYkSU_ppTdC8,66
|
|
37
39
|
orionis/console/output/enums/styles.py,sha256=6a4oQCOBOKMh2ARdeq5GlIskJ3wjiylYmh66tUKKmpQ,4053
|
|
38
40
|
orionis/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
orionis/container/container.py,sha256=
|
|
41
|
+
orionis/container/container.py,sha256=SYXNG43_C0LsgaY32IucbYocJHMuoJzPIIMXEMKtxtI,80303
|
|
40
42
|
orionis/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
43
|
orionis/container/context/manager.py,sha256=I08K_jKXSKmrq18Pv33qYyMKIlAovVOwIgmfiVm-J7c,2971
|
|
42
|
-
orionis/container/context/scope.py,sha256=
|
|
44
|
+
orionis/container/context/scope.py,sha256=p_oCzR7dDz-5ZAd16ab4vfLc3gBf34CaN0f4iR9D0bQ,1155
|
|
43
45
|
orionis/container/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
|
-
orionis/container/contracts/container.py,sha256=
|
|
45
|
-
orionis/container/contracts/resolver.py,sha256=cbzzLvUuv5FD8DHnjs8VGCjDnCHXPWezRPHS_qr93xs,3193
|
|
46
|
+
orionis/container/contracts/container.py,sha256=JUj5LuJBzSWCsv4tRNreUBXPGCMyK79ITx-RM_rKxTA,13442
|
|
46
47
|
orionis/container/contracts/service_provider.py,sha256=TJtwFoPYvw3hvBSfIEO3-httq8iszaRQh1IjCKfDyVM,1016
|
|
47
48
|
orionis/container/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
49
|
orionis/container/entities/binding.py,sha256=sY0ioHbRcjp9TSQjfrFHxkO3vRn_VOrbHK62_QEGe1U,3717
|
|
@@ -57,8 +58,6 @@ orionis/container/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
|
57
58
|
orionis/container/facades/facade.py,sha256=jzP4dTgDiaxPw-RWTHrE-DYiv8tXa1TQov1jx9Iti3c,3679
|
|
58
59
|
orionis/container/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
60
|
orionis/container/providers/service_provider.py,sha256=RqXpn8krFA3tt_m9CEG7-na7szp-zqfirO4DzpCHpF4,1685
|
|
60
|
-
orionis/container/resolver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
|
-
orionis/container/resolver/resolver.py,sha256=1hg0SO6PCaHXti7trmomKln2lDzaJGh0vkhwfHkNZLE,23478
|
|
62
61
|
orionis/container/validators/__init__.py,sha256=iJ_cY8U0EkpnZOU4_LANGKHFkvHeV0vH5bjbYr1fdSg,609
|
|
63
62
|
orionis/container/validators/implements.py,sha256=xDXK7yhG5GGGRT9Mj1UbbVrcVTgifmjFZdaAJG4Ke8o,3110
|
|
64
63
|
orionis/container/validators/is_abstract_class.py,sha256=vJqUPn610YZS0sEkV8c_gPZskIgWmFHjg3D3MF2OTs8,1141
|
|
@@ -96,7 +95,7 @@ orionis/foundation/config/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
|
|
|
96
95
|
orionis/foundation/config/database/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
97
96
|
orionis/foundation/config/database/entities/connections.py,sha256=jouNerG3hueYsmyhtY3wsoZYA5MSgooXS-aHHsn0bac,3797
|
|
98
97
|
orionis/foundation/config/database/entities/database.py,sha256=S3BkRaNsnH-_AlOwtPayT2OO0JPO0BNXoDFG-xfHdKM,2668
|
|
99
|
-
orionis/foundation/config/database/entities/mysql.py,sha256=
|
|
98
|
+
orionis/foundation/config/database/entities/mysql.py,sha256=VjCgZF5f3TLs5vjB5akFJyuXJ_u5x-n1sLjhTqP9120,10044
|
|
100
99
|
orionis/foundation/config/database/entities/oracle.py,sha256=M4ljgz0ZtXxNhtymr4nRoJWtuFvd-IDnlMxSG2Rwk7Y,9119
|
|
101
100
|
orionis/foundation/config/database/entities/pgsql.py,sha256=Q_PdzTel1Ryl6d5m-kaETEdn-Gixy_xG011652lXUqs,8007
|
|
102
101
|
orionis/foundation/config/database/entities/sqlite.py,sha256=I59GwCainSJfeeZAUBQds4nDFJGj8ILCjX2U-j2ycwU,7445
|
|
@@ -181,7 +180,7 @@ orionis/foundation/providers/progress_bar_provider.py,sha256=X4Ke7mPr0MgVp6WDNaQ
|
|
|
181
180
|
orionis/foundation/providers/testing_provider.py,sha256=YTubcNnWrG3SPx5NM5HgYefvUYoXdlzXcjljnjavUwM,6462
|
|
182
181
|
orionis/foundation/providers/workers_provider.py,sha256=5CvlUETdIblh7Wx8pT0MswTeTCGhYah-EvFqOrLu8Mo,4113
|
|
183
182
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
184
|
-
orionis/metadata/framework.py,sha256=
|
|
183
|
+
orionis/metadata/framework.py,sha256=nZIjGI1zBkVtVi-1ZXlbDNPq2bJCsAMvDWF0C4aWtD0,4088
|
|
185
184
|
orionis/metadata/package.py,sha256=k7Yriyp5aUcR-iR8SK2ec_lf0_Cyc-C7JczgXa-I67w,16039
|
|
186
185
|
orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
187
186
|
orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -214,38 +213,37 @@ orionis/services/environment/validators/types.py,sha256=hiTszo7hS_1zQLclUIDOFUTG
|
|
|
214
213
|
orionis/services/inspirational/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
215
214
|
orionis/services/inspirational/inspire.py,sha256=dUxwkNLjKC4jdi06cVB1gfyB2zHjfgdhYhwKtsOTf0Q,4090
|
|
216
215
|
orionis/services/inspirational/quotes.py,sha256=9hCIEFE0DdfXLaGq_SzFpXlC2AbGSnuFLzyec4Rd1H0,53455
|
|
216
|
+
orionis/services/inspirational/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
217
217
|
orionis/services/inspirational/contracts/inspire.py,sha256=--GGHAIxeEjQS0Ra3bilZ7lL5MWyLT9XhZ7-m-ZmqwU,404
|
|
218
218
|
orionis/services/introspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
219
219
|
orionis/services/introspection/reflection.py,sha256=_Wdy8Wtt3RKXAqg9o5rvYa_Hyu-Z4674LKnNVg7u7pU,11467
|
|
220
220
|
orionis/services/introspection/abstract/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
221
|
-
orionis/services/introspection/abstract/reflection.py,sha256=
|
|
221
|
+
orionis/services/introspection/abstract/reflection.py,sha256=utltfup1o-ttpdR7m4TkyRhbWcieNTZk8oMItvCziIc,50286
|
|
222
222
|
orionis/services/introspection/abstract/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
223
|
-
orionis/services/introspection/abstract/contracts/reflection.py,sha256=
|
|
223
|
+
orionis/services/introspection/abstract/contracts/reflection.py,sha256=UbRcqXahQ75RaLguH5qqMHHD_6Mr1Y0SH61K6VLfbc4,23562
|
|
224
224
|
orionis/services/introspection/callables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
225
|
-
orionis/services/introspection/callables/reflection.py,sha256=
|
|
225
|
+
orionis/services/introspection/callables/reflection.py,sha256=zzxrjExc2iIlfs3xfoeDrlMryc4SlU8YPtDxT06xUB8,8252
|
|
226
226
|
orionis/services/introspection/callables/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
227
|
-
orionis/services/introspection/callables/contracts/reflection.py,sha256=
|
|
227
|
+
orionis/services/introspection/callables/contracts/reflection.py,sha256=EZi9VfTf5GJBnMd47j_oJ8dENQ5-HzDbQ-4zSffrvpM,5523
|
|
228
228
|
orionis/services/introspection/concretes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
229
|
-
orionis/services/introspection/concretes/reflection.py,sha256=
|
|
229
|
+
orionis/services/introspection/concretes/reflection.py,sha256=5DkNr6gUYdccSo7htzILoV38OAJCwLz-jLXViqZg6eY,55916
|
|
230
230
|
orionis/services/introspection/concretes/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
231
|
-
orionis/services/introspection/concretes/contracts/reflection.py,sha256=
|
|
231
|
+
orionis/services/introspection/concretes/contracts/reflection.py,sha256=LwEAgdN_WLCfS9b8pnFRVfN0PTRK4Br9qngu5km5aIk,24955
|
|
232
232
|
orionis/services/introspection/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
233
|
-
orionis/services/introspection/dependencies/reflection.py,sha256=
|
|
233
|
+
orionis/services/introspection/dependencies/reflection.py,sha256=VEe3cY6LTpOW3dm0IFECTHh7F_9_X-siTAeQc2XRQeM,13451
|
|
234
234
|
orionis/services/introspection/dependencies/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
235
|
-
orionis/services/introspection/dependencies/contracts/reflection.py,sha256=
|
|
235
|
+
orionis/services/introspection/dependencies/contracts/reflection.py,sha256=DhkAmsl8fxNr3L1kCSpVmTZx9YBejq2kYcfUrCWG8o0,5364
|
|
236
236
|
orionis/services/introspection/dependencies/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
237
|
-
orionis/services/introspection/dependencies/entities/
|
|
238
|
-
orionis/services/introspection/dependencies/entities/
|
|
239
|
-
orionis/services/introspection/dependencies/entities/known_dependencies.py,sha256=ICaFjNG51DY1iKJ0SV4cbmLyg6SFGscnDB3DCO9mCOc,2453
|
|
240
|
-
orionis/services/introspection/dependencies/entities/method_dependencies.py,sha256=aZDtKID3t12zHYLw9Tt6EbV3KQg-q1S0b2h7sHk5fEU,2294
|
|
237
|
+
orionis/services/introspection/dependencies/entities/argument.py,sha256=o30iMSghV8CFBWmnM__8_IOnOGrCLZfRUIQGD2GVl_g,4188
|
|
238
|
+
orionis/services/introspection/dependencies/entities/resolve_argument.py,sha256=GxlW-JwoJwYO1TWH4aqJ982Y4mTiU69GEU3GlevDWtM,3373
|
|
241
239
|
orionis/services/introspection/exceptions/__init__.py,sha256=oe7uzaGwjeMgz62ZTeNn6ersCApOVv3PXFlUw0vYLQM,234
|
|
242
240
|
orionis/services/introspection/exceptions/attribute.py,sha256=_JerTjfhikYwC2FKJV8XbVZqiZdLcBt7WGtw8r6vkqo,473
|
|
243
241
|
orionis/services/introspection/exceptions/type.py,sha256=73DB8JoTbxd7LNMnZKXf4jJ8OzLyC0HPXgDo5pffkYY,466
|
|
244
242
|
orionis/services/introspection/exceptions/value.py,sha256=ywO_cwawEmB22uP3i4ofsZytO9QTbvy7axm9NzEfHr4,467
|
|
245
243
|
orionis/services/introspection/instances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
246
|
-
orionis/services/introspection/instances/reflection.py,sha256=
|
|
244
|
+
orionis/services/introspection/instances/reflection.py,sha256=3PzyFwQkDzQaKrEh8ICZp6iSskaBvcV5A6Sn4jgBqcQ,55038
|
|
247
245
|
orionis/services/introspection/instances/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
248
|
-
orionis/services/introspection/instances/contracts/reflection.py,sha256=
|
|
246
|
+
orionis/services/introspection/instances/contracts/reflection.py,sha256=OBZ7vI6KsII76oqIF63v1I-msh94_xGfhPZQvqAVLgY,20834
|
|
249
247
|
orionis/services/introspection/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
250
248
|
orionis/services/introspection/modules/reflection.py,sha256=I-8lMA_9ebBJo33MuZe4M0aymCKBojIj-IRuE9fO1Go,15549
|
|
251
249
|
orionis/services/introspection/modules/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -313,7 +311,7 @@ orionis/test/contracts/render.py,sha256=wpDQzUtT0r8KFZ7zPcxWHXQ1EVNKxzA_rZ6ZKUcZ
|
|
|
313
311
|
orionis/test/contracts/test_result.py,sha256=SNXJ2UerkweYn7uCT0i0HmMGP0XBrL_9KJs-0ZvIYU4,4002
|
|
314
312
|
orionis/test/contracts/unit_test.py,sha256=PSnjEyM-QGQ3Pm0ZOqaa8QdPOtilGBVO4R87JYdVa-8,5386
|
|
315
313
|
orionis/test/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
316
|
-
orionis/test/core/unit_test.py,sha256=
|
|
314
|
+
orionis/test/core/unit_test.py,sha256=WU107nW5mhLZ8wluhtxkaBNuOKaqAb6BswpdQ-ozCXI,64834
|
|
317
315
|
orionis/test/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
318
316
|
orionis/test/entities/result.py,sha256=IMAd1AiwOf2z8krTDBFMpQe_1PG4YJ5Z0qpbr9xZwjg,4507
|
|
319
317
|
orionis/test/enums/__init__.py,sha256=M3imAgMvKFTKg55FbtVoY3zxj7QRY9AfaUWxiSZVvn4,66
|
|
@@ -347,7 +345,7 @@ orionis/test/validators/web_report.py,sha256=n9BfzOZz6aEiNTypXcwuWbFRG0OdHNSmCNu
|
|
|
347
345
|
orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnIfJYgc,1206
|
|
348
346
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
349
347
|
orionis/test/view/render.py,sha256=f-zNhtKSg9R5Njqujbg2l2amAs2-mRVESneLIkWOZjU,4082
|
|
350
|
-
orionis-0.
|
|
348
|
+
orionis-0.451.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
|
|
351
349
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
352
350
|
tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
353
351
|
tests/container/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -364,12 +362,11 @@ tests/container/enums/test_lifetimes.py,sha256=JFb4q1rgo10C5ibQ6LS-776NevxCMNLSq
|
|
|
364
362
|
tests/container/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
365
363
|
tests/container/facades/test_facade.py,sha256=aCy0S6YaaiswGoodJEAhNkqJrMaEQL-CcWh2AgXMvvQ,2938
|
|
366
364
|
tests/container/mocks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
365
|
+
tests/container/mocks/mock_auto_resolution.py,sha256=PprLC_UbZb0hV69CTzZ3t-5FLLvE-WCTA-6W7wcOIZQ,7340
|
|
367
366
|
tests/container/mocks/mock_complex_classes.py,sha256=YkC8tgDHU0YVEkIeUPd39gp3zkGLpFObQKzjuxatqro,20307
|
|
368
367
|
tests/container/mocks/mock_simple_classes.py,sha256=bzKbmwOD-RBTT8GVN_W53ufGEWpjppe4g5mX6CI5Yk0,2317
|
|
369
368
|
tests/container/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
370
369
|
tests/container/providers/test_providers.py,sha256=qGh2vtrLYp_S7u3U64I22Fzr86NsDZw0tXtJioSDdms,2149
|
|
371
|
-
tests/container/resolver/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
372
|
-
tests/container/resolver/test_resolver.py,sha256=6p3XMIme53QLEbPpTBfs3dLzESMK_5fGYbr2TNPolTI,2313
|
|
373
370
|
tests/container/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
374
371
|
tests/container/validators/test_implements.py,sha256=XquLuD3WGRPfSj2Jfd5uBTV48h8FPU0E-cJeEjZohEo,6759
|
|
375
372
|
tests/container/validators/test_is_abstract_class.py,sha256=_xW8NrnrmG5tKocaGs83r118S-t-YbaMTal-cWXtM0k,6868
|
|
@@ -444,16 +441,16 @@ tests/services/environment/test_services_environment.py,sha256=8gbF2vK238lracBip
|
|
|
444
441
|
tests/services/introspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
445
442
|
tests/services/introspection/test_reflection.py,sha256=AaBi0zi7GphOqnagV8N48GZHUuoT7743Pw3oc6_As6I,13700
|
|
446
443
|
tests/services/introspection/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
447
|
-
tests/services/introspection/dependencies/test_reflect_dependencies.py,sha256=
|
|
444
|
+
tests/services/introspection/dependencies/test_reflect_dependencies.py,sha256=DRbYZC4EBreSS48txlZB_kzka1_NtOXZwI2ell_pOVc,13698
|
|
448
445
|
tests/services/introspection/dependencies/mocks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
449
446
|
tests/services/introspection/dependencies/mocks/mock_user.py,sha256=RxATxe0-Vm4HfX5jKz9Tny42E2fmrdtEN6ZEntbqRL8,912
|
|
450
447
|
tests/services/introspection/dependencies/mocks/mock_user_controller.py,sha256=Hu4Xys5HENpKaLqsEAjtp_C-M9y6ozmJ_-qmj3ZvK6c,1214
|
|
451
448
|
tests/services/introspection/dependencies/mocks/mock_users_permissions.py,sha256=oENXbS2qmQUudYSmnhB8fgHBqXZdbplplB-Y2nbx4hw,1388
|
|
452
449
|
tests/services/introspection/reflection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
453
|
-
tests/services/introspection/reflection/test_reflection_abstract.py,sha256=
|
|
454
|
-
tests/services/introspection/reflection/test_reflection_callable.py,sha256=
|
|
455
|
-
tests/services/introspection/reflection/test_reflection_concrete.py,sha256=
|
|
456
|
-
tests/services/introspection/reflection/test_reflection_instance.py,sha256=
|
|
450
|
+
tests/services/introspection/reflection/test_reflection_abstract.py,sha256=tL6gvsiZC6LntguAetYv1W1ts7oY8ruHF2iJpqFlFuM,42422
|
|
451
|
+
tests/services/introspection/reflection/test_reflection_callable.py,sha256=OVu4FmzkfVBbDrjWqrrq-1eqe9myNGygNpmtyCnu9hs,6817
|
|
452
|
+
tests/services/introspection/reflection/test_reflection_concrete.py,sha256=HXU5pzfwXEBP614yESqbtfZJiWBnZxHYAHB8FuE2hKs,39083
|
|
453
|
+
tests/services/introspection/reflection/test_reflection_instance.py,sha256=C4Aj8AxtTP0buoprdtb96Su3DBj9i-k9lcdf4WSYnQA,58039
|
|
457
454
|
tests/services/introspection/reflection/test_reflection_module.py,sha256=a4sjSHeKADHUO5FvSDg1wPYNGfO385JZxSCoIqjfuZE,24608
|
|
458
455
|
tests/services/introspection/reflection/mock/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
459
456
|
tests/services/introspection/reflection/mock/fake_reflect_instance.py,sha256=iMf_yKgk0Y91XUHhRcl2qw7Z83QeNspvLi_tl4Dp-rI,28032
|
|
@@ -491,8 +488,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
491
488
|
tests/testing/validators/test_testing_validators.py,sha256=WPo5GxTP6xE-Dw3X1vZoqOMpb6HhokjNSbgDsDRDvy4,16588
|
|
492
489
|
tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
493
490
|
tests/testing/view/test_render.py,sha256=tnnMBwS0iKUIbogLvu-7Rii50G6Koddp3XT4wgdFEYM,1050
|
|
494
|
-
orionis-0.
|
|
495
|
-
orionis-0.
|
|
496
|
-
orionis-0.
|
|
497
|
-
orionis-0.
|
|
498
|
-
orionis-0.
|
|
491
|
+
orionis-0.451.0.dist-info/METADATA,sha256=lcxa9cXizRq5Ui6Vw6UtmqUJnCN7UU14fsqsK3fOvOY,4772
|
|
492
|
+
orionis-0.451.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
493
|
+
orionis-0.451.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
|
494
|
+
orionis-0.451.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
|
|
495
|
+
orionis-0.451.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
class MockAppService:
|
|
2
|
+
"""
|
|
3
|
+
Mock service that can be auto-resolved by the dependency injection container.
|
|
4
|
+
|
|
5
|
+
This class simulates a basic application service with no external dependencies,
|
|
6
|
+
making it suitable for testing automatic resolution scenarios.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
def __init__(self):
|
|
10
|
+
# Set service identifier
|
|
11
|
+
self.name = "MockAppService"
|
|
12
|
+
# Mark as properly initialized
|
|
13
|
+
self.initialized = True
|
|
14
|
+
|
|
15
|
+
class MockDependency:
|
|
16
|
+
"""
|
|
17
|
+
Mock dependency for testing dependency injection scenarios.
|
|
18
|
+
|
|
19
|
+
This class represents a simple dependency that can be injected into other
|
|
20
|
+
services during container resolution testing.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self):
|
|
24
|
+
# Set a test value that can be verified in dependent services
|
|
25
|
+
self.value = "dependency_value"
|
|
26
|
+
|
|
27
|
+
class MockServiceWithDependency:
|
|
28
|
+
"""
|
|
29
|
+
Mock service that depends on another service for dependency injection testing.
|
|
30
|
+
|
|
31
|
+
This class demonstrates single dependency injection where the container
|
|
32
|
+
must resolve and inject the required MockDependency instance.
|
|
33
|
+
|
|
34
|
+
Parameters
|
|
35
|
+
----------
|
|
36
|
+
dependency : MockDependency
|
|
37
|
+
The dependency instance to be injected by the container.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def __init__(self, dependency: MockDependency):
|
|
41
|
+
# Store the injected dependency
|
|
42
|
+
self.dependency = dependency
|
|
43
|
+
# Set service identifier
|
|
44
|
+
self.name = "MockServiceWithDependency"
|
|
45
|
+
|
|
46
|
+
class MockServiceWithMultipleDependencies:
|
|
47
|
+
"""
|
|
48
|
+
Mock service with multiple dependencies for complex injection testing.
|
|
49
|
+
|
|
50
|
+
This class tests the container's ability to resolve and inject multiple
|
|
51
|
+
dependencies simultaneously in the correct order.
|
|
52
|
+
|
|
53
|
+
Parameters
|
|
54
|
+
----------
|
|
55
|
+
dependency : MockDependency
|
|
56
|
+
The primary dependency instance to be injected.
|
|
57
|
+
app_service : MockAppService
|
|
58
|
+
The application service instance to be injected.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
def __init__(self, dependency: MockDependency, app_service: MockAppService):
|
|
62
|
+
# Store the primary dependency
|
|
63
|
+
self.dependency = dependency
|
|
64
|
+
# Store the application service dependency
|
|
65
|
+
self.app_service = app_service
|
|
66
|
+
# Set service identifier
|
|
67
|
+
self.name = "MockServiceWithMultipleDependencies"
|
|
68
|
+
|
|
69
|
+
class MockServiceWithDefaultParam:
|
|
70
|
+
"""
|
|
71
|
+
Mock service with a default parameter for optional dependency testing.
|
|
72
|
+
|
|
73
|
+
This class tests the container's handling of services that have both
|
|
74
|
+
required dependencies and optional parameters with default values.
|
|
75
|
+
Parameters
|
|
76
|
+
----------
|
|
77
|
+
dependency : MockDependency
|
|
78
|
+
The required dependency instance to be injected.
|
|
79
|
+
optional_param : str, default "default_value"
|
|
80
|
+
An optional parameter that should not be resolved by the container.
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
def __init__(self, dependency: MockDependency, optional_param: str = "default_value"):
|
|
84
|
+
# Store the required dependency
|
|
85
|
+
self.dependency = dependency
|
|
86
|
+
# Store the optional parameter (should use default if not provided)
|
|
87
|
+
self.optional_param = optional_param
|
|
88
|
+
|
|
89
|
+
class MockServiceWithUnresolvableDependency:
|
|
90
|
+
"""
|
|
91
|
+
Mock service with a dependency that cannot be resolved by the container.
|
|
92
|
+
|
|
93
|
+
This class is used to test error handling when the container encounters
|
|
94
|
+
dependencies that cannot be automatically resolved (primitive types, etc.).
|
|
95
|
+
|
|
96
|
+
Parameters
|
|
97
|
+
----------
|
|
98
|
+
unresolvable_param : int
|
|
99
|
+
A primitive type parameter that cannot be auto-resolved by the container.
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
def __init__(self, unresolvable_param: int):
|
|
103
|
+
# Store the unresolvable parameter
|
|
104
|
+
self.unresolvable_param = unresolvable_param
|
|
105
|
+
|
|
106
|
+
class MockServiceWithMethodDependencies:
|
|
107
|
+
"""
|
|
108
|
+
Mock service with methods that have dependencies for method injection testing.
|
|
109
|
+
|
|
110
|
+
This class tests the container's ability to resolve dependencies for
|
|
111
|
+
specific method calls rather than just constructor injection.
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
def __init__(self):
|
|
115
|
+
# Set service identifier
|
|
116
|
+
self.name = "MockServiceWithMethodDependencies"
|
|
117
|
+
|
|
118
|
+
def process_data(self, dependency: MockDependency, data: str = "default") -> str:
|
|
119
|
+
"""
|
|
120
|
+
Process data using an injected dependency.
|
|
121
|
+
|
|
122
|
+
This method demonstrates dependency injection at the method level,
|
|
123
|
+
where the container must resolve the dependency parameter while
|
|
124
|
+
preserving optional parameters.
|
|
125
|
+
|
|
126
|
+
Parameters
|
|
127
|
+
----------
|
|
128
|
+
dependency : MockDependency
|
|
129
|
+
The dependency instance to be injected for data processing.
|
|
130
|
+
data : str, default "default"
|
|
131
|
+
The data string to be processed.
|
|
132
|
+
|
|
133
|
+
Returns
|
|
134
|
+
-------
|
|
135
|
+
str
|
|
136
|
+
A formatted string containing the processed data and dependency value.
|
|
137
|
+
"""
|
|
138
|
+
# Combine the input data with the dependency's value
|
|
139
|
+
return f"Processed {data} with {dependency.value}"
|
|
140
|
+
|
|
141
|
+
def complex_operation(self, dependency: MockDependency, app_service: MockAppService) -> dict:
|
|
142
|
+
"""
|
|
143
|
+
Perform a complex operation using multiple injected dependencies.
|
|
144
|
+
|
|
145
|
+
This method tests multiple dependency injection at the method level,
|
|
146
|
+
ensuring the container can resolve multiple dependencies simultaneously.
|
|
147
|
+
|
|
148
|
+
Parameters
|
|
149
|
+
----------
|
|
150
|
+
dependency : MockDependency
|
|
151
|
+
The primary dependency instance to be injected.
|
|
152
|
+
app_service : MockAppService
|
|
153
|
+
The application service instance to be injected.
|
|
154
|
+
|
|
155
|
+
Returns
|
|
156
|
+
-------
|
|
157
|
+
dict
|
|
158
|
+
A dictionary containing the dependency values and operation result.
|
|
159
|
+
"""
|
|
160
|
+
|
|
161
|
+
# Return a structured result containing information from both dependencies
|
|
162
|
+
return {
|
|
163
|
+
"dependency": dependency.value,
|
|
164
|
+
"app_service": app_service.name,
|
|
165
|
+
"result": "complex_operation_result"
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
# Non-resolvable classes (outside valid namespaces)
|
|
169
|
+
class ExternalLibraryClass:
|
|
170
|
+
"""
|
|
171
|
+
Simulates an external library class that shouldn't be auto-resolved.
|
|
172
|
+
|
|
173
|
+
This class represents dependencies from external libraries that should
|
|
174
|
+
not be automatically resolved by the container due to namespace restrictions.
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
def __init__(self):
|
|
178
|
+
# External classes typically have their own initialization logic
|
|
179
|
+
pass
|
|
180
|
+
|
|
181
|
+
# Configure module paths to simulate valid application namespaces
|
|
182
|
+
# These assignments make the classes appear to be in valid app namespaces for testing
|
|
183
|
+
MockAppService.__module__ = 'app.services.mock_app_service'
|
|
184
|
+
MockDependency.__module__ = 'app.dependencies.mock_dependency'
|
|
185
|
+
MockServiceWithDependency.__module__ = 'app.services.mock_service_with_dependency'
|
|
186
|
+
MockServiceWithMultipleDependencies.__module__ = 'app.services.mock_service_with_multiple_dependencies'
|
|
187
|
+
MockServiceWithDefaultParam.__module__ = 'app.services.mock_service_with_default_param'
|
|
188
|
+
MockServiceWithUnresolvableDependency.__module__ = 'app.services.mock_service_with_unresolvable_dependency'
|
|
189
|
+
MockServiceWithMethodDependencies.__module__ = 'app.services.mock_service_with_method_dependencies'
|
|
190
|
+
|
|
191
|
+
# External class should not be auto-resolved due to invalid namespace
|
|
192
|
+
ExternalLibraryClass.__module__ = 'external_library.some_module'
|