orionis 0.405.0__py3-none-any.whl → 0.406.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.
Files changed (154) hide show
  1. orionis/console/base/command.py +57 -50
  2. orionis/console/base/contracts/command.py +68 -0
  3. orionis/console/dynamic/contracts/progress_bar.py +3 -3
  4. orionis/console/dynamic/progress_bar.py +8 -8
  5. orionis/console/output/console.py +8 -2
  6. orionis/console/output/contracts/console.py +1 -1
  7. orionis/container/container.py +2 -2
  8. orionis/container/context/scope.py +4 -1
  9. orionis/container/contracts/service_provider.py +2 -2
  10. orionis/container/entities/binding.py +31 -44
  11. orionis/container/enums/lifetimes.py +22 -1
  12. orionis/container/facades/facade.py +1 -2
  13. orionis/container/providers/service_provider.py +2 -2
  14. orionis/foundation/application.py +542 -248
  15. orionis/foundation/config/app/entities/app.py +107 -90
  16. orionis/foundation/config/auth/entities/auth.py +4 -33
  17. orionis/foundation/config/cache/entities/cache.py +18 -41
  18. orionis/foundation/config/cache/entities/file.py +8 -35
  19. orionis/foundation/config/cache/entities/stores.py +17 -38
  20. orionis/foundation/config/cors/entities/cors.py +41 -54
  21. orionis/foundation/config/database/entities/connections.py +40 -56
  22. orionis/foundation/config/database/entities/database.py +11 -38
  23. orionis/foundation/config/database/entities/mysql.py +48 -76
  24. orionis/foundation/config/database/entities/oracle.py +30 -57
  25. orionis/foundation/config/database/entities/pgsql.py +45 -61
  26. orionis/foundation/config/database/entities/sqlite.py +26 -53
  27. orionis/foundation/config/filesystems/entitites/aws.py +28 -49
  28. orionis/foundation/config/filesystems/entitites/disks.py +27 -47
  29. orionis/foundation/config/filesystems/entitites/filesystems.py +15 -37
  30. orionis/foundation/config/filesystems/entitites/local.py +9 -35
  31. orionis/foundation/config/filesystems/entitites/public.py +14 -41
  32. orionis/foundation/config/logging/entities/channels.py +56 -86
  33. orionis/foundation/config/logging/entities/chunked.py +9 -9
  34. orionis/foundation/config/logging/entities/daily.py +8 -8
  35. orionis/foundation/config/logging/entities/hourly.py +6 -6
  36. orionis/foundation/config/logging/entities/logging.py +12 -18
  37. orionis/foundation/config/logging/entities/monthly.py +7 -7
  38. orionis/foundation/config/logging/entities/stack.py +5 -5
  39. orionis/foundation/config/logging/entities/weekly.py +6 -6
  40. orionis/foundation/config/mail/entities/file.py +9 -36
  41. orionis/foundation/config/mail/entities/mail.py +22 -40
  42. orionis/foundation/config/mail/entities/mailers.py +29 -44
  43. orionis/foundation/config/mail/entities/smtp.py +47 -48
  44. orionis/foundation/config/queue/entities/brokers.py +19 -41
  45. orionis/foundation/config/queue/entities/database.py +24 -46
  46. orionis/foundation/config/queue/entities/queue.py +28 -40
  47. orionis/foundation/config/roots/paths.py +272 -468
  48. orionis/foundation/config/session/entities/session.py +23 -53
  49. orionis/foundation/config/startup.py +165 -135
  50. orionis/foundation/config/testing/entities/testing.py +137 -122
  51. orionis/foundation/config/testing/enums/__init__.py +6 -2
  52. orionis/foundation/config/testing/enums/drivers.py +16 -0
  53. orionis/foundation/config/testing/enums/verbosity.py +18 -0
  54. orionis/foundation/contracts/application.py +152 -362
  55. orionis/foundation/providers/console_provider.py +24 -2
  56. orionis/foundation/providers/dumper_provider.py +24 -2
  57. orionis/foundation/providers/logger_provider.py +24 -2
  58. orionis/foundation/providers/path_resolver_provider.py +25 -2
  59. orionis/foundation/providers/progress_bar_provider.py +24 -2
  60. orionis/foundation/providers/testing_provider.py +39 -0
  61. orionis/foundation/providers/workers_provider.py +24 -2
  62. orionis/metadata/framework.py +1 -1
  63. orionis/services/environment/helpers/functions.py +1 -2
  64. orionis/services/environment/key/__init__.py +0 -0
  65. orionis/services/environment/key/key_generator.py +37 -0
  66. orionis/support/entities/__init__.py +0 -0
  67. orionis/support/entities/base.py +104 -0
  68. orionis/support/facades/testing.py +15 -0
  69. orionis/support/facades/workers.py +1 -1
  70. orionis/test/cases/asynchronous.py +0 -11
  71. orionis/test/cases/synchronous.py +0 -9
  72. orionis/test/contracts/dumper.py +11 -4
  73. orionis/test/contracts/kernel.py +5 -110
  74. orionis/test/contracts/logs.py +27 -65
  75. orionis/test/contracts/printer.py +16 -128
  76. orionis/test/contracts/test_result.py +100 -0
  77. orionis/test/contracts/unit_test.py +87 -150
  78. orionis/test/core/unit_test.py +608 -554
  79. orionis/test/entities/result.py +22 -2
  80. orionis/test/enums/__init__.py +0 -2
  81. orionis/test/enums/status.py +14 -9
  82. orionis/test/exceptions/config.py +9 -1
  83. orionis/test/exceptions/failure.py +34 -11
  84. orionis/test/exceptions/persistence.py +10 -2
  85. orionis/test/exceptions/runtime.py +9 -1
  86. orionis/test/exceptions/value.py +13 -1
  87. orionis/test/kernel.py +87 -289
  88. orionis/test/output/dumper.py +82 -18
  89. orionis/test/output/printer.py +399 -156
  90. orionis/test/records/logs.py +203 -82
  91. orionis/test/validators/__init__.py +33 -0
  92. orionis/test/validators/base_path.py +45 -0
  93. orionis/test/validators/execution_mode.py +45 -0
  94. orionis/test/validators/fail_fast.py +37 -0
  95. orionis/test/validators/folder_path.py +34 -0
  96. orionis/test/validators/module_name.py +31 -0
  97. orionis/test/validators/name_pattern.py +40 -0
  98. orionis/test/validators/pattern.py +36 -0
  99. orionis/test/validators/persistent.py +42 -0
  100. orionis/test/validators/persistent_driver.py +43 -0
  101. orionis/test/validators/print_result.py +37 -0
  102. orionis/test/validators/tags.py +37 -0
  103. orionis/test/validators/throw_exception.py +39 -0
  104. orionis/test/validators/verbosity.py +37 -0
  105. orionis/test/validators/web_report.py +35 -0
  106. orionis/test/validators/workers.py +31 -0
  107. orionis/test/view/render.py +48 -54
  108. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/METADATA +1 -1
  109. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/RECORD +149 -98
  110. tests/container/__init__.py +0 -0
  111. tests/container/context/__init__.py +0 -0
  112. tests/container/context/test_manager.py +27 -0
  113. tests/container/context/test_scope.py +23 -0
  114. tests/container/entities/__init__.py +0 -0
  115. tests/container/entities/test_binding.py +133 -0
  116. tests/container/enums/__init__.py +0 -0
  117. tests/container/enums/test_lifetimes.py +63 -0
  118. tests/container/facades/__init__.py +0 -0
  119. tests/container/facades/test_facade.py +61 -0
  120. tests/container/mocks/__init__.py +0 -0
  121. tests/container/mocks/mock_complex_classes.py +482 -0
  122. tests/container/mocks/mock_simple_classes.py +32 -0
  123. tests/container/providers/__init__.py +0 -0
  124. tests/container/providers/test_providers.py +48 -0
  125. tests/container/resolver/__init__.py +0 -0
  126. tests/container/resolver/test_resolver.py +55 -0
  127. tests/container/test_container.py +254 -0
  128. tests/container/test_singleton.py +98 -0
  129. tests/container/test_thread_safety.py +217 -0
  130. tests/container/validators/__init__.py +0 -0
  131. tests/container/validators/test_implements.py +140 -0
  132. tests/container/validators/test_is_abstract_class.py +99 -0
  133. tests/container/validators/test_is_callable.py +73 -0
  134. tests/container/validators/test_is_concrete_class.py +97 -0
  135. tests/container/validators/test_is_instance.py +105 -0
  136. tests/container/validators/test_is_not_subclass.py +117 -0
  137. tests/container/validators/test_is_subclass.py +115 -0
  138. tests/container/validators/test_is_valid_alias.py +113 -0
  139. tests/container/validators/test_lifetime.py +75 -0
  140. tests/foundation/config/testing/test_foundation_config_testing.py +1 -1
  141. tests/metadata/test_metadata_framework.py +18 -18
  142. tests/testing/test_testing_result.py +117 -117
  143. tests/testing/test_testing_unit.py +209 -209
  144. orionis/foundation/config/base.py +0 -112
  145. orionis/test/arguments/parser.py +0 -187
  146. orionis/test/contracts/parser.py +0 -43
  147. orionis/test/entities/arguments.py +0 -38
  148. orionis/test/enums/execution_mode.py +0 -16
  149. /orionis/{test/arguments → console/base/contracts}/__init__.py +0 -0
  150. /orionis/foundation/config/testing/enums/{test_mode.py → mode.py} +0 -0
  151. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/WHEEL +0 -0
  152. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/licenses/LICENCE +0 -0
  153. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/top_level.txt +0 -0
  154. {orionis-0.405.0.dist-info → orionis-0.406.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,63 @@
1
+ from orionis.container.enums.lifetimes import Lifetime
2
+ from orionis.test.cases.asynchronous import AsyncTestCase
3
+
4
+ class TestLifetime(AsyncTestCase):
5
+ """
6
+ Test cases for the Lifetime enum in orionis.container.enums.lifetimes.
7
+
8
+ Notes
9
+ -----
10
+ This test suite validates the enumeration values and behavior of the Lifetime enum
11
+ which defines the lifecycle types for dependency injection.
12
+ """
13
+
14
+ async def testLifetimeValuesExist(self) -> None:
15
+ """
16
+ Test that the Lifetime enum contains the expected values.
17
+
18
+ Verifies that TRANSIENT, SINGLETON, and SCOPED values are present in the enum.
19
+ """
20
+ self.assertIn(Lifetime.TRANSIENT, Lifetime)
21
+ self.assertIn(Lifetime.SINGLETON, Lifetime)
22
+ self.assertIn(Lifetime.SCOPED, Lifetime)
23
+
24
+ async def testLifetimeValuesAreUnique(self) -> None:
25
+ """
26
+ Test that all Lifetime enum values are unique.
27
+
28
+ Ensures that each enum value has a distinct integer value.
29
+ """
30
+ values = [member.value for member in Lifetime]
31
+ self.assertEqual(len(values), len(set(values)))
32
+
33
+ async def testLifetimeCount(self) -> None:
34
+ """
35
+ Test that the Lifetime enum has exactly 3 members.
36
+
37
+ Verifies that no additional or missing lifecycle types exist.
38
+ """
39
+ self.assertEqual(len(list(Lifetime)), 3)
40
+
41
+ async def testLifetimeStringRepresentation(self) -> None:
42
+ """
43
+ Test the string representation of Lifetime enum values.
44
+
45
+ Verifies that the string representation of enum values matches their names.
46
+ """
47
+ self.assertEqual(str(Lifetime.TRANSIENT), "Lifetime.TRANSIENT")
48
+ self.assertEqual(str(Lifetime.SINGLETON), "Lifetime.SINGLETON")
49
+ self.assertEqual(str(Lifetime.SCOPED), "Lifetime.SCOPED")
50
+
51
+ async def testLifetimeComparison(self) -> None:
52
+ """
53
+ Test comparison operations between Lifetime enum values.
54
+
55
+ Verifies that enum values can be correctly compared with each other.
56
+ """
57
+ self.assertNotEqual(Lifetime.TRANSIENT, Lifetime.SINGLETON)
58
+ self.assertNotEqual(Lifetime.SINGLETON, Lifetime.SCOPED)
59
+ self.assertNotEqual(Lifetime.TRANSIENT, Lifetime.SCOPED)
60
+
61
+ self.assertEqual(Lifetime.TRANSIENT, Lifetime.TRANSIENT)
62
+ self.assertEqual(Lifetime.SINGLETON, Lifetime.SINGLETON)
63
+ self.assertEqual(Lifetime.SCOPED, Lifetime.SCOPED)
File without changes
@@ -0,0 +1,61 @@
1
+ import inspect
2
+ from orionis.container.facades.facade import FacadeMeta, Facade
3
+ from orionis.test.cases.asynchronous import AsyncTestCase
4
+
5
+ class TestFacadeMethods(AsyncTestCase):
6
+
7
+ async def testFacadeMethodsExist(self):
8
+ """
9
+ Verify the existence of essential methods in the Facade and FacadeMeta classes.
10
+
11
+ This test ensures that the following methods are implemented:
12
+ - 'getFacadeAccessor' in the Facade class
13
+ - 'resolve' in the Facade class
14
+ - '__getattr__' in the FacadeMeta class
15
+
16
+ Returns:
17
+ None. The method asserts the presence of required methods and raises AssertionError if any are missing.
18
+ """
19
+
20
+ expected_methods = [
21
+ ("getFacadeAccessor", Facade),
22
+ ("resolve", Facade),
23
+ ("__getattr__", FacadeMeta),
24
+ ]
25
+
26
+ # Check each expected method for existence in its respective class
27
+ for method_name, cls in expected_methods:
28
+ self.assertTrue(
29
+ hasattr(cls, method_name),
30
+ f"Method '{method_name}' does not exist in {cls.__name__}."
31
+ )
32
+
33
+ async def testFacadeMethodSignatures(self):
34
+ """
35
+ Validate the method signatures of key Facade and FacadeMeta class methods.
36
+
37
+ This test checks that:
38
+ - 'getFacadeAccessor' in Facade accepts no parameters.
39
+ - 'resolve' in Facade accepts variable positional and keyword arguments.
40
+ - '__getattr__' in FacadeMeta accepts 'cls' and 'name' as parameters.
41
+
42
+ Returns:
43
+ None. The method asserts correct method signatures and raises AssertionError if any signature does not match expectations.
44
+ """
45
+
46
+ # Check that getFacadeAccessor has no parameters
47
+ sig = inspect.signature(Facade.getFacadeAccessor)
48
+ params = list(sig.parameters.values())
49
+ self.assertEqual(len(params), 0)
50
+
51
+ # Check that resolve has *args and **kwargs as parameters
52
+ sig = inspect.signature(Facade.resolve)
53
+ params = list(sig.parameters.values())
54
+ self.assertEqual(params[0].name, "args")
55
+ self.assertEqual(params[1].kind, inspect.Parameter.VAR_KEYWORD)
56
+
57
+ # Check that __getattr__ has 'cls' and 'name' as parameters
58
+ sig = inspect.signature(FacadeMeta.__getattr__)
59
+ params = list(sig.parameters.values())
60
+ self.assertEqual(params[0].name, "cls")
61
+ self.assertEqual(params[1].name, "name")
File without changes
@@ -0,0 +1,482 @@
1
+ from abc import ABC, abstractmethod
2
+ import asyncio
3
+
4
+ from tests.container.mocks.mock_simple_classes import ICar
5
+
6
+ def ejemplo(x:int = 3, y:int = 2):
7
+ return x + y
8
+
9
+ class AbstractFakeClass(ABC):
10
+
11
+ """
12
+ AbstractFakeClass es una clase abstracta basada en FakeClass, diseñada para simular atributos y métodos de diferentes niveles de visibilidad.
13
+ Define métodos y propiedades abstractas para ser implementadas por subclases concretas.
14
+ """
15
+
16
+ # Atributos de clase
17
+ public_attr: int = 42
18
+ dynamic_attr = None
19
+ _protected_attr: str = "protected"
20
+ __private_attr: str = "private"
21
+ __dd__: str = "dunder_value"
22
+
23
+ @property
24
+ @abstractmethod
25
+ def computed_public_property(self) -> str:
26
+ """
27
+ Computes and returns the value of a public property.
28
+
29
+ Returns:
30
+ str: The computed value of the public property.
31
+ """
32
+ pass
33
+
34
+ @property
35
+ @abstractmethod
36
+ def _computed_property_protected(self) -> str:
37
+ """
38
+ A protected method intended to compute and return a string property.
39
+
40
+ Returns:
41
+ str: The computed property as a string.
42
+ """
43
+ pass
44
+
45
+ def __init__(self) -> None:
46
+ self.public_attr = 42
47
+ self.dynamic_attr = None
48
+ self._protected_attr = "protected"
49
+ self.__private_attr = "private"
50
+ self.__dd__ = "dunder_value"
51
+
52
+ # Métodos de instancia
53
+ @abstractmethod
54
+ def instanceSyncMethod(self, x: int, y: int) -> int:
55
+ pass
56
+
57
+ @abstractmethod
58
+ async def instanceAsyncMethod(self, x: int, y: int) -> int:
59
+ pass
60
+
61
+ @abstractmethod
62
+ def _protectedsyncMethod(self, x: int, y: int) -> int:
63
+ pass
64
+
65
+ @abstractmethod
66
+ async def _protectedAsyncMethod(self, x: int, y: int) -> int:
67
+ pass
68
+
69
+ # Métodos de clase
70
+ @classmethod
71
+ @abstractmethod
72
+ def classSyncMethod(cls, x: int, y: int) -> int:
73
+ pass
74
+
75
+ @classmethod
76
+ @abstractmethod
77
+ async def classAsyncMethod(cls, x: int, y: int) -> int:
78
+ pass
79
+
80
+ @classmethod
81
+ @abstractmethod
82
+ def _classMethodProtected(cls, x: int, y: int) -> int:
83
+ pass
84
+
85
+ @classmethod
86
+ @abstractmethod
87
+ async def _classAsyncMethodProtected(cls, x: int, y: int) -> int:
88
+ pass
89
+
90
+ # Métodos estáticos
91
+ @staticmethod
92
+ @abstractmethod
93
+ def staticMethod(text: str) -> str:
94
+ pass
95
+
96
+ @staticmethod
97
+ @abstractmethod
98
+ async def staticAsyncMethod(text: str) -> str:
99
+ pass
100
+
101
+ @staticmethod
102
+ @abstractmethod
103
+ def _staticMethodProtected(text: str) -> str:
104
+ pass
105
+
106
+ @staticmethod
107
+ @abstractmethod
108
+ async def _staticAsyncMethodProtected(text: str) -> str:
109
+ pass
110
+
111
+ class FakeClass(AbstractFakeClass):
112
+ """
113
+ FakeClass is a test double class designed to simulate a variety of attribute and method visibilities for inspection and testing purposes.
114
+ This class provides:
115
+ - Public, protected, and private class-level and instance-level attributes.
116
+ - Public, protected, and private properties.
117
+ - Synchronous and asynchronous instance methods with varying visibilities.
118
+ - Synchronous and asynchronous class methods with varying visibilities.
119
+ - Synchronous and asynchronous static methods with varying visibilities.
120
+ public_attr (int): A public class and instance attribute set to 42.
121
+ dynamic_attr: A public attribute initialized to None, can be set dynamically.
122
+ _protected_attr (str): A protected class and instance attribute set to "protected".
123
+ __private_attr (str): A private class and instance attribute set to "private".
124
+ Properties:
125
+ computed_public_property (str): Returns "public property".
126
+ _computed_property_protected (str): Returns "protected property".
127
+ __computed_property_private (str): Returns "private property".
128
+ Methods:
129
+ instanceSyncMethod(x: int, y: int) -> int:
130
+ instanceAsyncMethod(x: int, y: int) -> int:
131
+ _protectedsyncMethod(x: int, y: int) -> int:
132
+ Protected synchronous addition method.
133
+ _protectedAsyncMethod(x: int, y: int) -> int:
134
+ Protected asynchronous addition method.
135
+ __privateSyncMethod(x: int, y: int) -> int:
136
+ Private synchronous addition method.
137
+ __privateAsyncMethod(x: int, y: int) -> int:
138
+ Private asynchronous addition method.
139
+ Class Methods:
140
+ classSyncMethod(x: int, y: int) -> int:
141
+ classAsyncMethod(x: int, y: int) -> int:
142
+ _classMethodProtected(x: int, y: int) -> int:
143
+ Protected synchronous class addition method.
144
+ _classAsyncMethodProtected(x: int, y: int) -> int:
145
+ Protected asynchronous class addition method.
146
+ __classMethodPrivate(x: int, y: int) -> int:
147
+ Private synchronous class addition method.
148
+ __classAsyncMethodPrivate(x: int, y: int) -> int:
149
+ Private asynchronous class addition method.
150
+ Static Methods:
151
+ staticMethod(text: str) -> str:
152
+ Synchronously converts the input text to uppercase.
153
+ staticAsyncMethod(text: str) -> str:
154
+ Asynchronously converts the input text to uppercase.
155
+ _staticMethodProtected(text: str) -> str:
156
+ Protected synchronous static method to uppercase text.
157
+ _staticAsyncMethodProtected(text: str) -> str:
158
+ Protected asynchronous static method to uppercase text.
159
+ __staticMethodPrivate(text: str) -> str:
160
+ Private synchronous static method to uppercase text.
161
+ __staticAsyncMethodPrivate(text: str) -> str:
162
+ Private asynchronous static method to uppercase text.
163
+ Note:
164
+ This class is intended for testing and inspection of attribute and method visibility, including Python's name mangling for private members.
165
+ """
166
+
167
+ # Class-level attribute (Public)
168
+ public_attr: int = 42
169
+ dynamic_attr = None
170
+
171
+ # Class-level attribute (Protected)
172
+ _protected_attr: str = "protected"
173
+
174
+ # Class-level attribute (Private)
175
+ __private_attr: str = "private"
176
+ __dd__: str = "dunder_value"
177
+
178
+ @property
179
+ def computed_public_property(self) -> str:
180
+ """
181
+ Returns the string "public" as a computed property.
182
+
183
+ Returns:
184
+ str: The string "public".
185
+ """
186
+ return f"public property"
187
+
188
+ @property
189
+ def _computed_property_protected(self) -> str:
190
+ """
191
+ Returns a string indicating that this is a protected computed property.
192
+
193
+ Returns:
194
+ str: The string "protected".
195
+ """
196
+ """A computed property."""
197
+ return f"protected property"
198
+
199
+ @property
200
+ def __computed_property_private(self) -> str:
201
+ """
202
+ Returns the string "private".
203
+
204
+ This is a private computed property method, typically used for internal logic or testing purposes.
205
+
206
+ Returns:
207
+ str: The string "private".
208
+ """
209
+ return f"private property"
210
+
211
+ def __init__(self, carro:ICar, *, edad:int=10, callback:ejemplo) -> None:
212
+ """
213
+ Initializes the instance with various attributes for testing attribute visibility.
214
+
215
+ Attributes:
216
+ public_attr (int): A public attribute set to 42.
217
+ _protected_attr (str): A protected attribute set to "protected".
218
+ __private_attr (str): A private attribute set to "private".
219
+ dynamic_attr: An attribute initialized to None, can be set dynamically.
220
+ __dd__ (str): A dunder (double underscore) attribute set to "dunder_value".
221
+ """
222
+
223
+ # Initialize attributes (Publics)
224
+ self.public_attr = 42
225
+ self.dynamic_attr = None
226
+
227
+ # Initialize attributes (Protected)
228
+ self._protected_attr = "protected"
229
+
230
+ # Initialize attributes (Private)
231
+ self.__private_attr = "private"
232
+ self.__dd__ = "dunder_value"
233
+
234
+ def instanceSyncMethod(self, x: int, y: int) -> int:
235
+ """
236
+ Synchronously adds two integers and returns the result.
237
+
238
+ Args:
239
+ x (int): The first integer to add.
240
+ y (int): The second integer to add.
241
+
242
+ Returns:
243
+ int: The sum of x and y.
244
+ """
245
+ return x + y
246
+
247
+ async def instanceAsyncMethod(self, x: int, y: int) -> int:
248
+ """
249
+ Asynchronously adds two integers and returns the result.
250
+
251
+ Args:
252
+ x (int): The first integer to add.
253
+ y (int): The second integer to add.
254
+
255
+ Returns:
256
+ int: The sum of x and y.
257
+ """
258
+ await asyncio.sleep(0.1)
259
+ return x + y
260
+
261
+ def _protectedsyncMethod(self, x: int, y: int) -> int:
262
+ """
263
+ Synchronously adds two integers and returns the result (protected method).
264
+
265
+ Args:
266
+ x (int): The first integer to add.
267
+ y (int): The second integer to add.
268
+
269
+ Returns:
270
+ int: The sum of x and y.
271
+ """
272
+ return x + y
273
+
274
+ async def _protectedAsyncMethod(self, x: int, y: int) -> int:
275
+ """
276
+ Asynchronously adds two integers and returns the result (protected method).
277
+
278
+ Args:
279
+ x (int): The first integer to add.
280
+ y (int): The second integer to add.
281
+
282
+ Returns:
283
+ int: The sum of x and y.
284
+ """
285
+ await asyncio.sleep(0.1)
286
+ return x + y
287
+
288
+ def __privateSyncMethod(self, x: int, y: int) -> int:
289
+ """
290
+ Synchronously adds two integers and returns the result (private method).
291
+
292
+ Args:
293
+ x (int): The first integer to add.
294
+ y (int): The second integer to add.
295
+
296
+ Returns:
297
+ int: The sum of x and y.
298
+ """
299
+ return x + y
300
+
301
+ async def __privateAsyncMethod(self, x: int, y: int) -> int:
302
+ """
303
+ Asynchronously adds two integers and returns the result (private method).
304
+
305
+ Args:
306
+ x (int): The first integer to add.
307
+ y (int): The second integer to add.
308
+
309
+ Returns:
310
+ int: The sum of x and y.
311
+ """
312
+ await asyncio.sleep(0.1)
313
+ return x + y
314
+
315
+ @classmethod
316
+ def classSyncMethod(cls, x: int, y: int) -> int:
317
+ """
318
+ Synchronously adds two integers and returns the result (class method).
319
+
320
+ Args:
321
+ x (int): The first integer to add.
322
+ y (int): The second integer to add.
323
+
324
+ Returns:
325
+ int: The sum of x and y.
326
+ """
327
+ return x + y
328
+
329
+ @classmethod
330
+ async def classAsyncMethod(cls, x: int, y: int) -> int:
331
+ """
332
+ Asynchronously adds two integers and returns the result (class method).
333
+
334
+ Args:
335
+ x (int): The first integer to add.
336
+ y (int): The second integer to add.
337
+
338
+ Returns:
339
+ int: The sum of x and y.
340
+ """
341
+ await asyncio.sleep(0.1)
342
+ return x + y
343
+
344
+ @classmethod
345
+ def _classMethodProtected(cls, x: int, y: int) -> int:
346
+ """
347
+ Synchronously adds two integers and returns the result (protected class method).
348
+
349
+ Args:
350
+ x (int): The first integer to add.
351
+ y (int): The second integer to add.
352
+
353
+ Returns:
354
+ int: The sum of x and y.
355
+ """
356
+ return x + y
357
+
358
+ @classmethod
359
+ async def _classAsyncMethodProtected(cls, x: int, y: int) -> int:
360
+ """
361
+ Asynchronously adds two integers and returns the result (protected class method).
362
+
363
+ Args:
364
+ x (int): The first integer to add.
365
+ y (int): The second integer to add.
366
+
367
+ Returns:
368
+ int: The sum of x and y.
369
+ """
370
+ await asyncio.sleep(0.1)
371
+ return x + y
372
+
373
+ @classmethod
374
+ def __classMethodPrivate(cls, x: int, y: int) -> int:
375
+ """
376
+ Synchronously adds two integers and returns the result (private class method).
377
+
378
+ Args:
379
+ x (int): The first integer to add.
380
+ y (int): The second integer to add.
381
+
382
+ Returns:
383
+ int: The sum of x and y.
384
+ """
385
+ return x + y
386
+
387
+ @classmethod
388
+ async def __classAsyncMethodPrivate(cls, x: int, y: int) -> int:
389
+ """
390
+ Asynchronously adds two integers and returns the result (private class method).
391
+
392
+ Args:
393
+ x (int): The first integer to add.
394
+ y (int): The second integer to add.
395
+
396
+ Returns:
397
+ int: The sum of x and y.
398
+ """
399
+ await asyncio.sleep(0.1)
400
+ return x + y
401
+
402
+ @staticmethod
403
+ def staticMethod(text: str) -> str:
404
+ """
405
+ Synchronously converts the input text to uppercase (static method).
406
+
407
+ Args:
408
+ text (str): The input string.
409
+
410
+ Returns:
411
+ str: The uppercase version of the input string.
412
+ """
413
+ return text.upper()
414
+
415
+ @staticmethod
416
+ async def staticAsyncMethod(text: str) -> str:
417
+ """
418
+ Asynchronously converts the input text to uppercase (static method).
419
+
420
+ Args:
421
+ text (str): The input string.
422
+
423
+ Returns:
424
+ str: The uppercase version of the input string.
425
+ """
426
+ await asyncio.sleep(0.1)
427
+ return text.upper()
428
+
429
+ @staticmethod
430
+ def _staticMethodProtected(text: str) -> str:
431
+ """
432
+ Synchronously converts the input text to uppercase (protected static method).
433
+
434
+ Args:
435
+ text (str): The input string.
436
+
437
+ Returns:
438
+ str: The uppercase version of the input string.
439
+ """
440
+ return text.upper()
441
+
442
+ @staticmethod
443
+ async def _staticAsyncMethodProtected(text: str) -> str:
444
+ """
445
+ Asynchronously converts the input text to uppercase (protected static method).
446
+
447
+ Args:
448
+ text (str): The input string.
449
+
450
+ Returns:
451
+ str: The uppercase version of the input string.
452
+ """
453
+ await asyncio.sleep(0.1)
454
+ return text.upper()
455
+
456
+ @staticmethod
457
+ def __staticMethodPrivate(text: str) -> str:
458
+ """
459
+ Synchronously converts the input text to uppercase (private static method).
460
+
461
+ Args:
462
+ text (str): The input string.
463
+
464
+ Returns:
465
+ str: The uppercase version of the input string.
466
+ """
467
+ return text.upper()
468
+
469
+ @staticmethod
470
+ async def __staticAsyncMethodPrivate(text: str) -> str:
471
+ """
472
+ Asynchronously converts the input text to uppercase (private static method).
473
+
474
+ Args:
475
+ text (str): The input string.
476
+
477
+ Returns:
478
+ str: The uppercase version of the input string.
479
+ """
480
+ await asyncio.sleep(0.1)
481
+ return text.upper()
482
+
@@ -0,0 +1,32 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ class ICar(ABC):
4
+ """
5
+ ICar is an interface that defines the structure for car objects.
6
+ It includes methods for starting and stopping the car.
7
+ """
8
+
9
+ @abstractmethod
10
+ def start(self) -> str:
11
+ """
12
+ Starts the car and returns a message indicating the car has started.
13
+ """
14
+ pass
15
+
16
+ @abstractmethod
17
+ def stop(self) -> str:
18
+ """
19
+ Stops the car and returns a message indicating the car has stopped.
20
+ """
21
+ pass
22
+
23
+ class Car(ICar):
24
+ def __init__(self, brand: str = 'a', model: str = 'b'):
25
+ self.brand = brand
26
+ self.model = model
27
+
28
+ def start(self):
29
+ return f"{self.brand} {self.model} is starting."
30
+
31
+ def stop(self):
32
+ return f"{self.brand} {self.model} is stopping."
File without changes
@@ -0,0 +1,48 @@
1
+ import inspect
2
+ from orionis.container.contracts.service_provider import IServiceProvider
3
+ from orionis.container.providers.service_provider import ServiceProvider
4
+ from orionis.test.cases.asynchronous import AsyncTestCase
5
+
6
+ class TestServiceProviderMethods(AsyncTestCase):
7
+
8
+ async def testMethodsExist(self):
9
+ """
10
+ Checks that the ServiceProvider class implements the required methods and constructor.
11
+
12
+ This test verifies the following:
13
+ - The existence of the '__init__', 'register', and 'boot' methods in ServiceProvider.
14
+ - That 'register' and 'boot' are asynchronous methods.
15
+ - That ServiceProvider inherits from IServiceProvider.
16
+
17
+ Returns:
18
+ None. The method uses assertions to validate class structure and method types.
19
+ """
20
+ # List of required methods and their associated class
21
+ expected_methods = [
22
+ ("__init__", ServiceProvider),
23
+ ("register", ServiceProvider),
24
+ ("boot", ServiceProvider),
25
+ ]
26
+
27
+ # Check that each required method exists in ServiceProvider
28
+ for method_name, cls in expected_methods:
29
+ self.assertTrue(
30
+ hasattr(cls, method_name),
31
+ f"Method '{method_name}' does not exist in {cls.__name__}."
32
+ )
33
+
34
+ # Ensure 'register' and 'boot' are asynchronous methods
35
+ self.assertTrue(
36
+ inspect.iscoroutinefunction(ServiceProvider.register),
37
+ "register must be async"
38
+ )
39
+ self.assertTrue(
40
+ inspect.iscoroutinefunction(ServiceProvider.boot),
41
+ "boot must be async"
42
+ )
43
+
44
+ # Ensure ServiceProvider inherits from IServiceProvider
45
+ self.assertTrue(
46
+ issubclass(ServiceProvider, IServiceProvider),
47
+ "ServiceProvider must inherit from IServiceProvider"
48
+ )
File without changes