orionis 0.422.0__py3-none-any.whl → 0.423.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.
@@ -5,7 +5,7 @@
5
5
  NAME = "orionis"
6
6
 
7
7
  # Current version of the framework
8
- VERSION = "0.422.0"
8
+ VERSION = "0.423.0"
9
9
 
10
10
  # Full name of the author or maintainer of the project
11
11
  AUTHOR = "Raul Mauricio Uñate Castro"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orionis
3
- Version: 0.422.0
3
+ Version: 0.423.0
4
4
  Summary: Orionis Framework – Elegant, Fast, and Powerful.
5
5
  Home-page: https://github.com/orionis-framework/framework
6
6
  Author: Raul Mauricio Uñate Castro
@@ -1,5 +1,3 @@
1
- environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- environment/test_services_environment.py,sha256=6UH3g2Z2DQYtGnyySCRnT35VCENlL-PQWHIdH6zA9rw,3767
3
1
  orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
2
  orionis/_console/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
3
  orionis/_console/command_filter.py,sha256=bn0fcWfQg13DrQBaV4NopNxdP-6up0G54Qmhg7r_BKA,1211
@@ -187,7 +185,7 @@ orionis/foundation/providers/progress_bar_provider.py,sha256=WW3grNgH-yV2meSSTeO
187
185
  orionis/foundation/providers/testing_provider.py,sha256=iJSN2RIChbYIL-1ue6vmPmDMCSrvERDkti4Er9MPiLA,1102
188
186
  orionis/foundation/providers/workers_provider.py,sha256=kiQjQRyUEyiBX2zcbF_KmqRgvc7Bvxsvg5oMtIvYniM,1075
189
187
  orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
190
- orionis/metadata/framework.py,sha256=TN0bWAwI_0NXglzLrTW6uOK-Oq8T4PwkGoWeuBrZsUM,4960
188
+ orionis/metadata/framework.py,sha256=4ObKf3_80JdUtm-5cIFr9tho1b7Xi1akA-66eblfV6g,4960
191
189
  orionis/metadata/package.py,sha256=tqLfBRo-w1j_GN4xvzUNFyweWYFS-qhSgAEc-AmCH1M,5452
192
190
  orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
193
191
  orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -355,7 +353,7 @@ orionis/test/validators/web_report.py,sha256=-h3Fe9jY93_kzUhd2NBIqEfCcBpu-8Ei9x3
355
353
  orionis/test/validators/workers.py,sha256=LGffDKtK6SKixFKzIYPQpI5aFeQPAGXpv_LUtmEu6g4,1102
356
354
  orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
357
355
  orionis/test/view/render.py,sha256=3ICz68l-WF3BtnYqH5m-ktN9UD00MELMbmMnyJDV74A,4768
358
- orionis-0.422.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
356
+ orionis-0.423.0.dist-info/licenses/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
359
357
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
360
358
  tests/container/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
361
359
  tests/container/test_container.py,sha256=asv8TkkupVoex6SWod74NBl4dSs7wb9mLmu_glNdNy8,14815
@@ -387,6 +385,8 @@ tests/container/validators/test_is_not_subclass.py,sha256=1OCPtCRuysm7OKL6XhuXJP
387
385
  tests/container/validators/test_is_subclass.py,sha256=0Uc8uIR69ZX7G5Nrex0LMQXrueTdncdDxfQoila3h3U,5834
388
386
  tests/container/validators/test_is_valid_alias.py,sha256=egVf6IfSXurIdu8hKo03rwsM1P-bxGOFd1_9JjDHJIk,5657
389
387
  tests/container/validators/test_lifetime.py,sha256=5PequjXAcIcp0Q4TIki7THSU31XftGpI0u1mVGqHmpU,4692
388
+ tests/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
389
+ tests/environment/test_services_environment.py,sha256=Xf61PQJHgZSmDuASwWZBuoVnB353cibClyo9_EC3X0k,9567
390
390
  tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
391
391
  tests/example/test_example.py,sha256=XJEcsro3vCO5m4zvMiWUGphvd0C7oIkBtUfQgTDsdUU,25568
392
392
  tests/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -498,8 +498,8 @@ tests/testing/validators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
498
498
  tests/testing/validators/test_testing_validators.py,sha256=QdcF0Vhnnl_kD-PzceHJbUYOqwPTB1Td7YaTv8LTr30,19612
499
499
  tests/testing/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
500
500
  tests/testing/view/test_render.py,sha256=-ghGG8rimyb2b2wtvMuSPPH7Zac5_NlVCiUcHRA5SNg,1172
501
- orionis-0.422.0.dist-info/METADATA,sha256=uT4PtXxf3WCmccOyQhLgYtP9EsMs9gWS1dq_RQnZwts,4772
502
- orionis-0.422.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
503
- orionis-0.422.0.dist-info/top_level.txt,sha256=0G1WIo0HbkZ6hNbKp6cdXLoKj1SfULEORhCuPIV_Dqw,26
504
- orionis-0.422.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
505
- orionis-0.422.0.dist-info/RECORD,,
501
+ orionis-0.423.0.dist-info/METADATA,sha256=sCWDt2p6GoLQ8lvYWZvDwnfDE6ipPB1GC2Ae9L2t7wE,4772
502
+ orionis-0.423.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
503
+ orionis-0.423.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
504
+ orionis-0.423.0.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
505
+ orionis-0.423.0.dist-info/RECORD,,
@@ -1,3 +1,2 @@
1
- environment
2
1
  orionis
3
2
  tests
@@ -0,0 +1,227 @@
1
+ from pathlib import Path
2
+ from orionis.services.environment.env import Env
3
+ from orionis.test.cases.asynchronous import AsyncTestCase
4
+ import os
5
+ from orionis.services.environment.core.dot_env import DotEnv
6
+ from orionis.services.environment.enums.value_type import EnvironmentValueType
7
+ from orionis.services.environment.core.dot_env import DotEnv
8
+
9
+ class TestServicesEnvironment(AsyncTestCase):
10
+
11
+ async def testSetAndGetConstants(self):
12
+ """
13
+ Stores and retrieves framework metadata constants using Env.set and Env.get.
14
+
15
+ This test imports several metadata constants from the `orionis.metadata.framework` module,
16
+ sets each constant in the Env storage using `Env.set`, and verifies that the operation succeeds.
17
+ It then retrieves each constant using `Env.get` and asserts that the retrieved value matches
18
+ the original constant.
19
+
20
+ Parameters
21
+ ----------
22
+ self : TestServicesEnvironment
23
+ The test case instance.
24
+
25
+ Returns
26
+ -------
27
+ None
28
+ This method does not return a value. Assertions are used to validate behavior.
29
+
30
+ Notes
31
+ -----
32
+ - Ensures that `Env.set` returns True for each constant.
33
+ - Ensures that `Env.get` returns the correct value for each constant.
34
+ """
35
+ from orionis.metadata.framework import (
36
+ NAME, VERSION, AUTHOR, AUTHOR_EMAIL, DESCRIPTION,
37
+ SKELETON, FRAMEWORK, DOCS, API, PYTHON_REQUIRES
38
+ )
39
+
40
+ # Prepare a dictionary of constant names and their values
41
+ constants = {
42
+ "NAME": NAME,
43
+ "VERSION": VERSION,
44
+ "AUTHOR": AUTHOR,
45
+ "AUTHOR_EMAIL": AUTHOR_EMAIL,
46
+ "DESCRIPTION": DESCRIPTION,
47
+ "SKELETON": SKELETON,
48
+ "FRAMEWORK": FRAMEWORK,
49
+ "DOCS": DOCS,
50
+ "API": API,
51
+ "PYTHON_REQUIRES": PYTHON_REQUIRES
52
+ }
53
+
54
+ # Set each constant in the environment and assert the operation succeeds
55
+ for key, value in constants.items():
56
+ result = Env.set(key, value)
57
+ self.assertTrue(result)
58
+
59
+ # Retrieve each constant and assert the value matches the original
60
+ for key, value in constants.items():
61
+ retrieved = Env.get(key)
62
+ self.assertEqual(retrieved, value)
63
+
64
+ async def testGetNonExistentKey(self):
65
+ """
66
+ Test the behavior of `Env.get` when retrieving a non-existent environment key.
67
+
68
+ This test verifies that attempting to retrieve a value for a key that has not been set
69
+ in the environment returns `None`. This ensures that the environment behaves as expected
70
+ when queried for missing keys.
71
+
72
+ Parameters
73
+ ----------
74
+ self : TestServicesEnvironment
75
+ The test case instance.
76
+
77
+ Returns
78
+ -------
79
+ None
80
+ This method does not return a value. Assertions are used to validate that `Env.get`
81
+ returns `None` for a non-existent key.
82
+
83
+ Notes
84
+ -----
85
+ - Ensures that `Env.get` returns `None` when the specified key does not exist in the environment.
86
+ """
87
+
88
+ # Attempt to retrieve a value for a key that has not been set.
89
+ self.assertIsNone(Env.get("NON_EXISTENT_KEY"))
90
+
91
+ async def testDotEnvSetAndGetWithType(self):
92
+ """
93
+ Test DotEnv.set and DotEnv.get with explicit EnvironmentValueType for various data types.
94
+
95
+ This test verifies that the `DotEnv` class correctly stores and retrieves environment variables
96
+ when an explicit `EnvironmentValueType` is provided. For each supported data type, the test sets
97
+ a value using `DotEnv.set` with the corresponding `EnvironmentValueType`, then retrieves it using
98
+ `DotEnv.get` and asserts that the returned value is correctly prefixed or formatted according to
99
+ the specified type.
100
+
101
+ Parameters
102
+ ----------
103
+ self : TestServicesEnvironment
104
+ The test case instance.
105
+
106
+ Returns
107
+ -------
108
+ None
109
+ This method does not return a value. Assertions are used to validate the correct behavior
110
+ of `DotEnv.set` and `DotEnv.get` with explicit type information.
111
+
112
+ Notes
113
+ -----
114
+ - Ensures that values are stored and retrieved with the correct type prefixes or formatting.
115
+ - Covers all supported types: PATH, STR, INT, FLOAT, BOOL, LIST, DICT, TUPLE, SET, BASE64.
116
+ """
117
+
118
+ env = DotEnv()
119
+
120
+ # Set and assert a PATH value with explicit type
121
+ env.set("CAST_EXAMPLE_PATH", '/tests', EnvironmentValueType.PATH)
122
+ self.assertEqual(env.get("CAST_EXAMPLE_PATH"), Path(Path.cwd(), 'tests'))
123
+
124
+ # Set and assert a string value with explicit type
125
+ env.set("CAST_EXAMPLE_STR", 'hello', EnvironmentValueType.STR)
126
+ self.assertEqual(env.get("CAST_EXAMPLE_STR"), "hello")
127
+
128
+ # Set and assert an integer value with explicit type
129
+ env.set("CAST_EXAMPLE_INT", 123, EnvironmentValueType.INT)
130
+ self.assertEqual(env.get("CAST_EXAMPLE_INT"), 123)
131
+
132
+ # Set and assert a float value with explicit type
133
+ env.set("CAST_EXAMPLE_FLOAT", 3.14, EnvironmentValueType.FLOAT)
134
+ self.assertEqual(env.get("CAST_EXAMPLE_FLOAT"), 3.14)
135
+
136
+ # Set and assert a boolean value with explicit type
137
+ env.set("CAST_EXAMPLE_BOOL", True, EnvironmentValueType.BOOL)
138
+ self.assertEqual(env.get("CAST_EXAMPLE_BOOL"), True)
139
+
140
+ # Set and assert a list value with explicit type
141
+ env.set("CAST_EXAMPLE_LIST", [1, 2, 3], EnvironmentValueType.LIST)
142
+ self.assertEqual(env.get("CAST_EXAMPLE_LIST"), [1, 2, 3])
143
+
144
+ # Set and assert a dictionary value with explicit type
145
+ env.set("CAST_EXAMPLE_DICT", {"a": 1, "b": 2}, EnvironmentValueType.DICT)
146
+ self.assertEqual(env.get("CAST_EXAMPLE_DICT"), {"a": 1, "b": 2})
147
+
148
+ # Set and assert a tuple value with explicit type
149
+ env.set("CAST_EXAMPLE_TUPLE", (1, 2), EnvironmentValueType.TUPLE)
150
+ self.assertEqual(env.get("CAST_EXAMPLE_TUPLE"), (1, 2))
151
+
152
+ # Set and assert a set value with explicit type
153
+ env.set("CAST_EXAMPLE_SET", {1, 2, 3}, EnvironmentValueType.SET)
154
+ self.assertEqual(env.get("CAST_EXAMPLE_SET"), {1, 2, 3})
155
+
156
+ # Set and assert a base64 value with explicit type
157
+ ramdon_text = os.urandom(32).hex()
158
+ env.set("CAST_EXAMPLE_BASE64", ramdon_text, EnvironmentValueType.BASE64)
159
+ self.assertEqual(env.get("CAST_EXAMPLE_BASE64"), ramdon_text)
160
+
161
+ async def testDotEnvSetAndGetWithoutType(self):
162
+ """
163
+ Test DotEnv.set and DotEnv.get without explicit EnvironmentValueType for various data types.
164
+
165
+ This test verifies that the `DotEnv` class can store and retrieve environment variables of different
166
+ Python data types without specifying an explicit `EnvironmentValueType`. It checks that the values
167
+ are stored and retrieved as their string representations, and asserts the correctness of the returned
168
+ values for each data type.
169
+
170
+ Parameters
171
+ ----------
172
+ self : TestServicesEnvironment
173
+ The test case instance.
174
+
175
+ Returns
176
+ -------
177
+ None
178
+ This method does not return a value. Assertions are used to validate that the returned values
179
+ from `DotEnv.get` match the expected string representations for each data type.
180
+
181
+ Notes
182
+ -----
183
+ - Ensures that values are stored and retrieved as strings when no explicit type is provided.
184
+ - Covers various data types: path, str, int, float, bool, list, dict, tuple, set, and base64.
185
+ """
186
+
187
+ env = DotEnv()
188
+
189
+ # Set and get a path value without explicit type
190
+ env.set("EXAMPLE_PATH", '/tests')
191
+ self.assertEqual(env.get("EXAMPLE_PATH"), '/tests')
192
+
193
+ # Set and get a string value without explicit type
194
+ env.set("EXAMPLE_STR", 'hello')
195
+ self.assertEqual(env.get("EXAMPLE_STR"), 'hello')
196
+
197
+ # Set and get an integer value without explicit type
198
+ env.set("EXAMPLE_INT", 123)
199
+ self.assertEqual(env.get("EXAMPLE_INT"), 123)
200
+
201
+ # Set and get a float value without explicit type
202
+ env.set("EXAMPLE_FLOAT", 3.14)
203
+ self.assertEqual(env.get("EXAMPLE_FLOAT"), 3.14)
204
+
205
+ # Set and get a boolean value without explicit type
206
+ env.set("EXAMPLE_BOOL", True)
207
+ self.assertEqual(env.get("EXAMPLE_BOOL"), True)
208
+
209
+ # Set and get a list value without explicit type
210
+ env.set("EXAMPLE_LIST", [1, 2, 3])
211
+ self.assertEqual(env.get("EXAMPLE_LIST"), [1, 2, 3])
212
+
213
+ # Set and get a dictionary value without explicit type
214
+ env.set("EXAMPLE_DICT", {"a": 1, "b": 2})
215
+ self.assertEqual(env.get("EXAMPLE_DICT"), {"a": 1, "b": 2})
216
+
217
+ # Set and get a tuple value without explicit type
218
+ env.set("EXAMPLE_TUPLE", (1, 2))
219
+ self.assertEqual(env.get("EXAMPLE_TUPLE"), (1, 2))
220
+
221
+ # Set and get a set value without explicit type
222
+ env.set("EXAMPLE_SET", {1, 2, 3})
223
+ self.assertEqual(env.get("EXAMPLE_SET"), {1, 2, 3})
224
+
225
+ # Set and get a base64 value without explicit type
226
+ env.set("EXAMPLE_BASE64", "T3Jpb25pcyBGcmFtZXdvcms=")
227
+ self.assertEqual(env.get("EXAMPLE_BASE64"), 'T3Jpb25pcyBGcmFtZXdvcms=')
@@ -1,93 +0,0 @@
1
- from orionis.services.environment.env import Env
2
- from orionis.test.cases.asynchronous import AsyncTestCase
3
-
4
- class TestServicesEnvironment(AsyncTestCase):
5
-
6
- async def testSetAndGetConstants(self):
7
- """
8
- Test storing and retrieving framework metadata constants using Env.set and Env.get.
9
-
10
- Imports several metadata constants from the `orionis.metadata.framework` module, sets each constant
11
- in the Env storage using `Env.set`, and verifies that the operation succeeds. Then retrieves each
12
- constant using `Env.get` and asserts that the retrieved value matches the original constant.
13
-
14
- Ensures
15
- -------
16
- - `Env.set` returns True for each constant.
17
- - `Env.get` returns the correct value for each constant.
18
- """
19
- from orionis.metadata.framework import (
20
- NAME, VERSION, AUTHOR, AUTHOR_EMAIL, DESCRIPTION,
21
- SKELETON, FRAMEWORK, DOCS, API, PYTHON_REQUIRES
22
- )
23
- constants = {
24
- "NAME": NAME,
25
- "VERSION": VERSION,
26
- "AUTHOR": AUTHOR,
27
- "AUTHOR_EMAIL": AUTHOR_EMAIL,
28
- "DESCRIPTION": DESCRIPTION,
29
- "SKELETON": SKELETON,
30
- "FRAMEWORK": FRAMEWORK,
31
- "DOCS": DOCS,
32
- "API": API,
33
- "PYTHON_REQUIRES": PYTHON_REQUIRES
34
- }
35
- for key, value in constants.items():
36
- result = Env.set(key, value)
37
- self.assertTrue(result)
38
- for key, value in constants.items():
39
- retrieved = Env.get(key)
40
- self.assertEqual(retrieved, value)
41
-
42
- async def testGetNonExistentKey(self):
43
- """
44
- Test that Env.get returns None for a non-existent environment key.
45
-
46
- Ensures
47
- -------
48
- - `Env.get` returns None when the key does not exist.
49
- """
50
- self.assertIsNone(Env.get("NON_EXISTENT_KEY"))
51
-
52
- async def testTypeHints(self):
53
- """
54
- Test that Env.set and Env.get correctly handle and preserve Python type hints.
55
-
56
- Sets environment variables with various data types (int, float, bool, str, list, dict, tuple, set)
57
- using the `Env.set` method, specifying the type as a string. Then retrieves each variable using
58
- `Env.get` and asserts that the returned value is of the expected Python type.
59
-
60
- Ensures
61
- -------
62
- - The returned value from `Env.get` matches the expected Python type for each variable.
63
- """
64
-
65
- # Set environment variables with type hints
66
- Env.set("TEST_INT", 42, 'int')
67
- Env.set("TEST_FLOAT", 3.14, 'float')
68
- Env.set("TEST_BOOL", True, 'bool')
69
- Env.set("TEST_STR", "Hello, World!", 'str')
70
- Env.set("TEST_LIST", [1, 2, 3], 'list')
71
- Env.set("TEST_DICT", {"key": "value"}, 'dict')
72
- Env.set("TEST_TUPLE", (1,2,3), 'tuple')
73
- Env.set("TEST_SET", {1, 2, 3}, 'set')
74
-
75
- # Retrieve and check types
76
- self.assertIsInstance(Env.get("TEST_INT"), int)
77
- self.assertIsInstance(Env.get("TEST_FLOAT"), float)
78
- self.assertIsInstance(Env.get("TEST_BOOL"), bool)
79
- self.assertIsInstance(Env.get("TEST_STR"), str)
80
- self.assertIsInstance(Env.get("TEST_LIST"), list)
81
- self.assertIsInstance(Env.get("TEST_DICT"), dict)
82
- self.assertIsInstance(Env.get("TEST_TUPLE"), tuple)
83
- self.assertIsInstance(Env.get("TEST_SET"), set)
84
-
85
- # Clean up environment variables after test
86
- Env.unset("TEST_INT")
87
- Env.unset("TEST_FLOAT")
88
- Env.unset("TEST_BOOL")
89
- Env.unset("TEST_STR")
90
- Env.unset("TEST_LIST")
91
- Env.unset("TEST_DICT")
92
- Env.unset("TEST_TUPLE")
93
- Env.unset("TEST_SET")
File without changes