orionis 0.546.0__py3-none-any.whl → 0.547.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/scheduler_event_listener.py +0 -17
- orionis/console/contracts/schedule_event_listener.py +0 -18
- orionis/foundation/config/app/entities/app.py +3 -2
- orionis/foundation/config/app/enums/ciphers.py +5 -19
- orionis/foundation/config/session/entities/session.py +2 -2
- orionis/metadata/framework.py +1 -1
- orionis/services/encrypter/encrypter.py +115 -0
- orionis/services/environment/dynamic/caster.py +35 -27
- orionis/services/environment/key/key_generator.py +32 -11
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/METADATA +1 -1
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/RECORD +15 -159
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/top_level.txt +0 -1
- tests/container/__init__.py +0 -0
- tests/container/context/__init__.py +0 -0
- tests/container/context/test_manager.py +0 -38
- tests/container/context/test_scope.py +0 -32
- tests/container/core/__init__.py +0 -0
- tests/container/core/test_advanced_async.py +0 -234
- tests/container/core/test_async_optimizations.py +0 -268
- tests/container/core/test_container.py +0 -453
- tests/container/core/test_singleton.py +0 -122
- tests/container/core/test_thread_safety.py +0 -90
- tests/container/entities/__init__.py +0 -0
- tests/container/entities/test_binding.py +0 -242
- tests/container/enums/__init__.py +0 -0
- tests/container/enums/test_lifetimes.py +0 -97
- tests/container/facades/__init__.py +0 -0
- tests/container/facades/test_facade.py +0 -78
- tests/container/mocks/__init__.py +0 -0
- tests/container/mocks/mock_advanced_async.py +0 -332
- tests/container/mocks/mock_async_optimizations.py +0 -407
- tests/container/mocks/mock_auto_resolution.py +0 -192
- tests/container/mocks/mock_complex_classes.py +0 -792
- tests/container/mocks/mock_simple_classes.py +0 -98
- tests/container/providers/__init__.py +0 -0
- tests/container/providers/test_providers.py +0 -55
- tests/container/validators/__init__.py +0 -0
- tests/container/validators/test_implements.py +0 -186
- tests/container/validators/test_is_abstract_class.py +0 -147
- tests/container/validators/test_is_callable.py +0 -102
- tests/container/validators/test_is_concrete_class.py +0 -160
- tests/container/validators/test_is_instance.py +0 -150
- tests/container/validators/test_is_not_subclass.py +0 -49
- tests/container/validators/test_is_subclass.py +0 -178
- tests/container/validators/test_is_valid_alias.py +0 -147
- tests/container/validators/test_lifetime.py +0 -106
- tests/example/__init__.py +0 -0
- tests/example/test_example.py +0 -725
- tests/foundation/__init__.py +0 -0
- tests/foundation/config/__init__.py +0 -0
- tests/foundation/config/app/__init__.py +0 -0
- tests/foundation/config/app/test_foundation_config_app.py +0 -262
- tests/foundation/config/auth/__init__.py +0 -0
- tests/foundation/config/auth/test_foundation_config_auth.py +0 -29
- tests/foundation/config/cache/__init__.py +0 -0
- tests/foundation/config/cache/test_foundation_config_cache.py +0 -143
- tests/foundation/config/cache/test_foundation_config_cache_file.py +0 -126
- tests/foundation/config/cache/test_foundation_config_cache_stores.py +0 -156
- tests/foundation/config/cors/__init__.py +0 -0
- tests/foundation/config/cors/test_foundation_config_cors.py +0 -190
- tests/foundation/config/database/__init__.py +0 -0
- tests/foundation/config/database/test_foundation_config_database.py +0 -158
- tests/foundation/config/database/test_foundation_config_database_connections.py +0 -203
- tests/foundation/config/database/test_foundation_config_database_mysql.py +0 -354
- tests/foundation/config/database/test_foundation_config_database_oracle.py +0 -288
- tests/foundation/config/database/test_foundation_config_database_pgsql.py +0 -257
- tests/foundation/config/database/test_foundation_config_database_sqlite.py +0 -207
- tests/foundation/config/filesystems/__init__.py +0 -0
- tests/foundation/config/filesystems/test_foundation_config_filesystems.py +0 -160
- tests/foundation/config/filesystems/test_foundation_config_filesystems_aws.py +0 -189
- tests/foundation/config/filesystems/test_foundation_config_filesystems_disks.py +0 -184
- tests/foundation/config/filesystems/test_foundation_config_filesystems_local.py +0 -143
- tests/foundation/config/filesystems/test_foundation_config_filesystems_public.py +0 -184
- tests/foundation/config/logging/__init__.py +0 -0
- tests/foundation/config/logging/test_foundation_config_logging.py +0 -112
- tests/foundation/config/logging/test_foundation_config_logging_channels.py +0 -246
- tests/foundation/config/logging/test_foundation_config_logging_chunked.py +0 -217
- tests/foundation/config/logging/test_foundation_config_logging_daily.py +0 -220
- tests/foundation/config/logging/test_foundation_config_logging_hourly.py +0 -196
- tests/foundation/config/logging/test_foundation_config_logging_monthly.py +0 -214
- tests/foundation/config/logging/test_foundation_config_logging_stack.py +0 -178
- tests/foundation/config/logging/test_foundation_config_logging_weekly.py +0 -224
- tests/foundation/config/mail/__init__.py +0 -0
- tests/foundation/config/mail/test_foundation_config_mail.py +0 -145
- tests/foundation/config/mail/test_foundation_config_mail_file.py +0 -97
- tests/foundation/config/mail/test_foundation_config_mail_mailers.py +0 -106
- tests/foundation/config/mail/test_foundation_config_mail_smtp.py +0 -146
- tests/foundation/config/queue/__init__.py +0 -0
- tests/foundation/config/queue/test_foundation_config_queue.py +0 -88
- tests/foundation/config/queue/test_foundation_config_queue_brokers.py +0 -72
- tests/foundation/config/queue/test_foundation_config_queue_database.py +0 -134
- tests/foundation/config/root/__init__.py +0 -0
- tests/foundation/config/root/test_foundation_config_root_paths.py +0 -112
- tests/foundation/config/session/__init__.py +0 -0
- tests/foundation/config/session/test_foundation_config_session.py +0 -213
- tests/foundation/config/startup/__init__.py +0 -0
- tests/foundation/config/startup/test_foundation_config_startup.py +0 -202
- tests/foundation/config/testing/__init__.py +0 -0
- tests/foundation/config/testing/test_foundation_config_testing.py +0 -235
- tests/metadata/__init__.py +0 -0
- tests/metadata/test_metadata_framework.py +0 -140
- tests/metadata/test_metadata_package.py +0 -139
- tests/services/__init__.py +0 -0
- tests/services/asynchrony/__init__.py +0 -0
- tests/services/asynchrony/test_services_asynchrony_coroutine.py +0 -85
- tests/services/environment/__init__.py +0 -0
- tests/services/environment/test_services_environment.py +0 -226
- tests/services/introspection/__init__.py +0 -0
- tests/services/introspection/dependencies/__init__.py +0 -0
- tests/services/introspection/dependencies/mocks/__init__.py +0 -0
- tests/services/introspection/dependencies/mocks/mock_user.py +0 -30
- tests/services/introspection/dependencies/mocks/mock_user_controller.py +0 -27
- tests/services/introspection/dependencies/mocks/mock_users_permissions.py +0 -41
- tests/services/introspection/dependencies/test_reflect_dependencies.py +0 -261
- tests/services/introspection/reflection/__init__.py +0 -0
- tests/services/introspection/reflection/mock/__init__.py +0 -0
- tests/services/introspection/reflection/mock/fake_reflect_instance.py +0 -1115
- tests/services/introspection/reflection/test_reflection_abstract.py +0 -1011
- tests/services/introspection/reflection/test_reflection_callable.py +0 -206
- tests/services/introspection/reflection/test_reflection_concrete.py +0 -952
- tests/services/introspection/reflection/test_reflection_instance.py +0 -1233
- tests/services/introspection/reflection/test_reflection_module.py +0 -567
- tests/services/introspection/test_reflection.py +0 -462
- tests/services/log/__init__.py +0 -0
- tests/services/log/test_log.py +0 -97
- tests/services/system/__init__.py +0 -0
- tests/services/system/test_services_system_imports.py +0 -204
- tests/services/system/test_services_system_workers.py +0 -131
- tests/support/__init__.py +0 -0
- tests/support/entities/__init__.py +0 -0
- tests/support/entities/mock_dataclass.py +0 -40
- tests/support/entities/test_base.py +0 -64
- tests/support/patterns/__init__.py +0 -0
- tests/support/patterns/singleton/__init__.py +0 -0
- tests/support/patterns/singleton/test_patterns_singleton.py +0 -39
- tests/support/standard/__init__.py +0 -0
- tests/support/standard/test_services_std.py +0 -226
- tests/support/wrapper/__init__.py +0 -0
- tests/support/wrapper/test_services_wrapper_docdict.py +0 -202
- tests/testing/__init__.py +0 -0
- tests/testing/cases/__init__.py +0 -0
- tests/testing/cases/test_testing_asynchronous.py +0 -63
- tests/testing/cases/test_testing_synchronous.py +0 -57
- tests/testing/entities/__init__.py +0 -0
- tests/testing/entities/test_testing_result.py +0 -146
- tests/testing/enums/__init__.py +0 -0
- tests/testing/enums/test_testing_status.py +0 -63
- tests/testing/output/__init__.py +0 -0
- tests/testing/output/test_testing_dumper.py +0 -29
- tests/testing/output/test_testing_printer.py +0 -42
- tests/testing/records/__init__.py +0 -0
- tests/testing/records/test_testing_records.py +0 -171
- tests/testing/test_testing_unit.py +0 -164
- tests/testing/validators/__init__.py +0 -0
- tests/testing/validators/test_testing_validators.py +0 -392
- tests/testing/view/__init__.py +0 -0
- tests/testing/view/test_render.py +0 -30
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/WHEEL +0 -0
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/zip-safe +0 -0
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
from orionis.support.standard.exceptions import OrionisStdValueException
|
|
2
|
-
from orionis.support.standard.std import StdClass
|
|
3
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
4
|
-
|
|
5
|
-
class TestSupportStd(AsyncTestCase):
|
|
6
|
-
|
|
7
|
-
async def testInitializationAndAccess(self):
|
|
8
|
-
"""
|
|
9
|
-
Test initialization and attribute access of StdClass.
|
|
10
|
-
|
|
11
|
-
Parameters
|
|
12
|
-
----------
|
|
13
|
-
self : TestSupportStd
|
|
14
|
-
The test case instance.
|
|
15
|
-
|
|
16
|
-
Returns
|
|
17
|
-
-------
|
|
18
|
-
None
|
|
19
|
-
|
|
20
|
-
Notes
|
|
21
|
-
-----
|
|
22
|
-
Verifies that StdClass can be instantiated with specific attributes and
|
|
23
|
-
that those attributes are accessible after initialization.
|
|
24
|
-
"""
|
|
25
|
-
obj = StdClass(
|
|
26
|
-
first_name='Raul',
|
|
27
|
-
last_name='Uñate',
|
|
28
|
-
age=31
|
|
29
|
-
)
|
|
30
|
-
self.assertEqual(obj.first_name, 'Raul')
|
|
31
|
-
self.assertEqual(obj.age, 31)
|
|
32
|
-
|
|
33
|
-
async def testToDictReturnsCorrectData(self):
|
|
34
|
-
"""
|
|
35
|
-
Test that StdClass.toDict returns a dictionary with correct attribute data.
|
|
36
|
-
|
|
37
|
-
Parameters
|
|
38
|
-
----------
|
|
39
|
-
self : TestSupportStd
|
|
40
|
-
The test case instance.
|
|
41
|
-
|
|
42
|
-
Returns
|
|
43
|
-
-------
|
|
44
|
-
None
|
|
45
|
-
|
|
46
|
-
Notes
|
|
47
|
-
-----
|
|
48
|
-
Ensures that toDict() returns a dictionary containing all attributes and their values.
|
|
49
|
-
"""
|
|
50
|
-
obj = StdClass(a=1, b=2)
|
|
51
|
-
expected = {'a': 1, 'b': 2}
|
|
52
|
-
self.assertEqual(obj.toDict(), expected)
|
|
53
|
-
|
|
54
|
-
async def testUpdateAttributes(self):
|
|
55
|
-
"""
|
|
56
|
-
Test updating multiple attributes using StdClass.update.
|
|
57
|
-
|
|
58
|
-
Parameters
|
|
59
|
-
----------
|
|
60
|
-
self : TestSupportStd
|
|
61
|
-
The test case instance.
|
|
62
|
-
|
|
63
|
-
Returns
|
|
64
|
-
-------
|
|
65
|
-
None
|
|
66
|
-
|
|
67
|
-
Notes
|
|
68
|
-
-----
|
|
69
|
-
Verifies that update() sets multiple attributes as expected.
|
|
70
|
-
"""
|
|
71
|
-
obj = StdClass()
|
|
72
|
-
obj.update(foo='bar', number=42)
|
|
73
|
-
self.assertEqual(obj.foo, 'bar')
|
|
74
|
-
self.assertEqual(obj.number, 42)
|
|
75
|
-
|
|
76
|
-
async def testUpdateReservedAttributeRaisesError(self):
|
|
77
|
-
"""
|
|
78
|
-
Test that updating a reserved attribute raises OrionisStdValueException.
|
|
79
|
-
|
|
80
|
-
Parameters
|
|
81
|
-
----------
|
|
82
|
-
self : TestSupportStd
|
|
83
|
-
The test case instance.
|
|
84
|
-
|
|
85
|
-
Returns
|
|
86
|
-
-------
|
|
87
|
-
None
|
|
88
|
-
|
|
89
|
-
Notes
|
|
90
|
-
-----
|
|
91
|
-
Ensures that attempting to update a reserved attribute (e.g., '__init__')
|
|
92
|
-
raises the appropriate exception.
|
|
93
|
-
"""
|
|
94
|
-
obj = StdClass()
|
|
95
|
-
with self.assertRaises(OrionisStdValueException):
|
|
96
|
-
obj.update(__init__='bad')
|
|
97
|
-
|
|
98
|
-
async def testUpdateConflictingAttributeRaisesError(self):
|
|
99
|
-
"""
|
|
100
|
-
Test that updating with a conflicting attribute name raises OrionisStdValueException.
|
|
101
|
-
|
|
102
|
-
Parameters
|
|
103
|
-
----------
|
|
104
|
-
self : TestSupportStd
|
|
105
|
-
The test case instance.
|
|
106
|
-
|
|
107
|
-
Returns
|
|
108
|
-
-------
|
|
109
|
-
None
|
|
110
|
-
|
|
111
|
-
Notes
|
|
112
|
-
-----
|
|
113
|
-
Ensures that updating with a name that conflicts with an existing method
|
|
114
|
-
or reserved attribute (e.g., 'toDict') raises an exception.
|
|
115
|
-
"""
|
|
116
|
-
obj = StdClass()
|
|
117
|
-
with self.assertRaises(OrionisStdValueException):
|
|
118
|
-
obj.update(toDict='oops')
|
|
119
|
-
|
|
120
|
-
async def testRemoveExistingAttributes(self):
|
|
121
|
-
"""
|
|
122
|
-
Test removal of an existing attribute using StdClass.remove.
|
|
123
|
-
|
|
124
|
-
Parameters
|
|
125
|
-
----------
|
|
126
|
-
self : TestSupportStd
|
|
127
|
-
The test case instance.
|
|
128
|
-
|
|
129
|
-
Returns
|
|
130
|
-
-------
|
|
131
|
-
None
|
|
132
|
-
|
|
133
|
-
Notes
|
|
134
|
-
-----
|
|
135
|
-
Removes an attribute and checks that it no longer exists, while others remain.
|
|
136
|
-
"""
|
|
137
|
-
obj = StdClass(x=1, y=2)
|
|
138
|
-
obj.remove('x')
|
|
139
|
-
self.assertFalse(hasattr(obj, 'x'))
|
|
140
|
-
self.assertTrue(hasattr(obj, 'y'))
|
|
141
|
-
|
|
142
|
-
async def testRemoveNonExistingAttributeRaisesError(self):
|
|
143
|
-
"""
|
|
144
|
-
Test that removing a non-existing attribute raises AttributeError.
|
|
145
|
-
|
|
146
|
-
Parameters
|
|
147
|
-
----------
|
|
148
|
-
self : TestSupportStd
|
|
149
|
-
The test case instance.
|
|
150
|
-
|
|
151
|
-
Returns
|
|
152
|
-
-------
|
|
153
|
-
None
|
|
154
|
-
|
|
155
|
-
Notes
|
|
156
|
-
-----
|
|
157
|
-
Ensures that attempting to remove an attribute that does not exist raises an error.
|
|
158
|
-
"""
|
|
159
|
-
obj = StdClass()
|
|
160
|
-
with self.assertRaises(AttributeError):
|
|
161
|
-
obj.remove('not_there')
|
|
162
|
-
|
|
163
|
-
async def testFromDictCreatesEquivalentInstance(self):
|
|
164
|
-
"""
|
|
165
|
-
Test creation of StdClass instance from a dictionary using fromDict.
|
|
166
|
-
|
|
167
|
-
Parameters
|
|
168
|
-
----------
|
|
169
|
-
self : TestSupportStd
|
|
170
|
-
The test case instance.
|
|
171
|
-
|
|
172
|
-
Returns
|
|
173
|
-
-------
|
|
174
|
-
None
|
|
175
|
-
|
|
176
|
-
Notes
|
|
177
|
-
-----
|
|
178
|
-
Verifies that fromDict creates an instance whose attributes match the input dictionary.
|
|
179
|
-
"""
|
|
180
|
-
data = {'a': 10, 'b': 20}
|
|
181
|
-
obj = StdClass.fromDict(data)
|
|
182
|
-
self.assertEqual(obj.toDict(), data)
|
|
183
|
-
|
|
184
|
-
async def testReprAndStr(self):
|
|
185
|
-
"""
|
|
186
|
-
Test __repr__ and __str__ methods of StdClass for expected output.
|
|
187
|
-
|
|
188
|
-
Parameters
|
|
189
|
-
----------
|
|
190
|
-
self : TestSupportStd
|
|
191
|
-
The test case instance.
|
|
192
|
-
|
|
193
|
-
Returns
|
|
194
|
-
-------
|
|
195
|
-
None
|
|
196
|
-
|
|
197
|
-
Notes
|
|
198
|
-
-----
|
|
199
|
-
Checks that __repr__ includes the class name and __str__ includes attribute key-value pairs.
|
|
200
|
-
"""
|
|
201
|
-
obj = StdClass(x=5)
|
|
202
|
-
self.assertIn("StdClass", repr(obj))
|
|
203
|
-
self.assertIn("'x': 5", str(obj))
|
|
204
|
-
|
|
205
|
-
async def testEquality(self):
|
|
206
|
-
"""
|
|
207
|
-
Test equality and inequality operations for StdClass instances.
|
|
208
|
-
|
|
209
|
-
Parameters
|
|
210
|
-
----------
|
|
211
|
-
self : TestSupportStd
|
|
212
|
-
The test case instance.
|
|
213
|
-
|
|
214
|
-
Returns
|
|
215
|
-
-------
|
|
216
|
-
None
|
|
217
|
-
|
|
218
|
-
Notes
|
|
219
|
-
-----
|
|
220
|
-
Verifies that instances with identical attributes are equal and those with different attributes are not.
|
|
221
|
-
"""
|
|
222
|
-
a = StdClass(x=1, y=2)
|
|
223
|
-
b = StdClass(x=1, y=2)
|
|
224
|
-
c = StdClass(x=3)
|
|
225
|
-
self.assertEqual(a, b)
|
|
226
|
-
self.assertNotEqual(a, c)
|
|
File without changes
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
from orionis.support.wrapper import DotDict
|
|
2
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
3
|
-
|
|
4
|
-
class TestSupportWrapperDocDict(AsyncTestCase):
|
|
5
|
-
|
|
6
|
-
async def testDotNotationAccess(self):
|
|
7
|
-
"""
|
|
8
|
-
Test dot notation access for dictionary values.
|
|
9
|
-
|
|
10
|
-
Checks that values in a DotDict instance can be accessed using dot notation,
|
|
11
|
-
including nested dictionaries via chained dot notation. Also verifies that
|
|
12
|
-
accessing a non-existent key returns None.
|
|
13
|
-
|
|
14
|
-
Returns
|
|
15
|
-
-------
|
|
16
|
-
None
|
|
17
|
-
"""
|
|
18
|
-
# Create a DotDict instance with initial values
|
|
19
|
-
dd = DotDict({'key1': 'value1', 'nested': {'inner': 42}})
|
|
20
|
-
|
|
21
|
-
# Access existing key using dot notation
|
|
22
|
-
self.assertEqual(dd.key1, 'value1')
|
|
23
|
-
|
|
24
|
-
# Access nested dictionary value using chained dot notation
|
|
25
|
-
self.assertEqual(dd.nested.inner, 42)
|
|
26
|
-
|
|
27
|
-
# Access non-existent key, should return None
|
|
28
|
-
self.assertIsNone(dd.non_existent)
|
|
29
|
-
|
|
30
|
-
async def testDotNotationAssignment(self):
|
|
31
|
-
"""
|
|
32
|
-
Test assignment of dictionary values using dot notation.
|
|
33
|
-
|
|
34
|
-
Verifies that new keys can be added and existing keys updated using dot notation.
|
|
35
|
-
Also checks that nested dictionaries assigned via dot notation are automatically
|
|
36
|
-
converted to DotDict instances.
|
|
37
|
-
|
|
38
|
-
Returns
|
|
39
|
-
-------
|
|
40
|
-
None
|
|
41
|
-
"""
|
|
42
|
-
# Create a DotDict instance and assign values using dot notation
|
|
43
|
-
dd = DotDict()
|
|
44
|
-
|
|
45
|
-
# Assign new key using dot notation
|
|
46
|
-
dd.key1 = 'value1'
|
|
47
|
-
|
|
48
|
-
# Assign nested dictionary, should convert to DotDict
|
|
49
|
-
dd.nested = {'inner': 42}
|
|
50
|
-
|
|
51
|
-
# Verify the assignments
|
|
52
|
-
self.assertEqual(dd['key1'], 'value1')
|
|
53
|
-
self.assertIsInstance(dd.nested, DotDict)
|
|
54
|
-
self.assertEqual(dd.nested.inner, 42)
|
|
55
|
-
|
|
56
|
-
async def testDotNotationDeletion(self):
|
|
57
|
-
"""
|
|
58
|
-
Test deletion of dictionary keys using dot notation.
|
|
59
|
-
|
|
60
|
-
Ensures that existing keys can be deleted using dot notation and that attempting
|
|
61
|
-
to delete a non-existent key raises an AttributeError.
|
|
62
|
-
|
|
63
|
-
Returns
|
|
64
|
-
-------
|
|
65
|
-
None
|
|
66
|
-
"""
|
|
67
|
-
# Create a DotDict instance and delete an existing key
|
|
68
|
-
dd = DotDict({'key1': 'value1', 'key2': 'value2'})
|
|
69
|
-
|
|
70
|
-
# Delete existing key using dot notation
|
|
71
|
-
del dd.key1
|
|
72
|
-
self.assertNotIn('key1', dd)
|
|
73
|
-
|
|
74
|
-
# Attempt to delete non-existent key, should raise AttributeError
|
|
75
|
-
with self.assertRaises(AttributeError):
|
|
76
|
-
del dd.non_existent
|
|
77
|
-
|
|
78
|
-
async def testGetMethod(self):
|
|
79
|
-
"""
|
|
80
|
-
Test the `get` method with automatic DotDict conversion.
|
|
81
|
-
|
|
82
|
-
Verifies that the `get` method returns the correct value for a given key,
|
|
83
|
-
returns the provided default for missing keys, and converts nested dictionaries
|
|
84
|
-
to DotDict instances when accessed.
|
|
85
|
-
|
|
86
|
-
Returns
|
|
87
|
-
-------
|
|
88
|
-
None
|
|
89
|
-
"""
|
|
90
|
-
# Create a DotDict instance and test the `get` method
|
|
91
|
-
dd = DotDict({'key1': 'value1', 'nested': {'inner': 42}})
|
|
92
|
-
|
|
93
|
-
self.assertEqual(dd.get('key1'), 'value1')
|
|
94
|
-
self.assertEqual(dd.get('non_existent', 'default'), 'default')
|
|
95
|
-
|
|
96
|
-
# Nested dictionary should be returned as DotDict
|
|
97
|
-
self.assertIsInstance(dd.get('nested'), DotDict)
|
|
98
|
-
self.assertEqual(dd.get('nested').inner, 42)
|
|
99
|
-
|
|
100
|
-
async def testExportMethod(self):
|
|
101
|
-
"""
|
|
102
|
-
Test the `export` method for recursive conversion to regular dict.
|
|
103
|
-
|
|
104
|
-
Ensures that calling `export` on a DotDict instance recursively converts
|
|
105
|
-
all nested DotDict objects back to regular Python dictionaries.
|
|
106
|
-
|
|
107
|
-
Returns
|
|
108
|
-
-------
|
|
109
|
-
None
|
|
110
|
-
"""
|
|
111
|
-
# Create a DotDict instance and export it
|
|
112
|
-
dd = DotDict({
|
|
113
|
-
'key1': 'value1',
|
|
114
|
-
'nested': DotDict({
|
|
115
|
-
'inner': 42,
|
|
116
|
-
'deep': DotDict({'a': 1})
|
|
117
|
-
})
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
exported = dd.export()
|
|
121
|
-
|
|
122
|
-
# Top-level and nested DotDicts should be converted to dicts
|
|
123
|
-
self.assertIsInstance(exported, dict)
|
|
124
|
-
self.assertIsInstance(exported['nested'], dict)
|
|
125
|
-
self.assertIsInstance(exported['nested']['deep'], dict)
|
|
126
|
-
self.assertEqual(exported['nested']['inner'], 42)
|
|
127
|
-
|
|
128
|
-
async def testCopyMethod(self):
|
|
129
|
-
"""
|
|
130
|
-
Test the `copy` method for deep copy with DotDict conversion.
|
|
131
|
-
|
|
132
|
-
Verifies that copying a DotDict instance produces an independent copy,
|
|
133
|
-
with all nested dictionaries converted to DotDict instances. Checks that
|
|
134
|
-
changes to the copy do not affect the original.
|
|
135
|
-
|
|
136
|
-
Returns
|
|
137
|
-
-------
|
|
138
|
-
None
|
|
139
|
-
"""
|
|
140
|
-
# Create a DotDict instance and copy it
|
|
141
|
-
original = DotDict({
|
|
142
|
-
'key1': 'value1',
|
|
143
|
-
'nested': {'inner': 42}
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
# Copy the original DotDict
|
|
147
|
-
copied = original.copy()
|
|
148
|
-
|
|
149
|
-
# Modify the copy and verify original is unchanged
|
|
150
|
-
copied.key1 = 'modified'
|
|
151
|
-
copied.nested.inner = 100
|
|
152
|
-
|
|
153
|
-
# Check that original remains unchanged
|
|
154
|
-
self.assertEqual(original.key1, 'value1')
|
|
155
|
-
self.assertEqual(original.nested.inner, 42)
|
|
156
|
-
self.assertEqual(copied.key1, 'modified')
|
|
157
|
-
self.assertEqual(copied.nested.inner, 100)
|
|
158
|
-
self.assertIsInstance(copied.nested, DotDict)
|
|
159
|
-
|
|
160
|
-
async def testNestedDictConversion(self):
|
|
161
|
-
"""
|
|
162
|
-
Test automatic conversion of nested dictionaries to DotDict.
|
|
163
|
-
|
|
164
|
-
Verifies that nested dictionaries are converted to DotDict instances
|
|
165
|
-
both during initialization and dynamic assignment.
|
|
166
|
-
|
|
167
|
-
Returns
|
|
168
|
-
-------
|
|
169
|
-
None
|
|
170
|
-
"""
|
|
171
|
-
dd = DotDict({
|
|
172
|
-
'level1': {
|
|
173
|
-
'level2': {
|
|
174
|
-
'value': 42
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
})
|
|
178
|
-
|
|
179
|
-
# Nested dicts should be DotDict instances
|
|
180
|
-
self.assertIsInstance(dd.level1, DotDict)
|
|
181
|
-
self.assertIsInstance(dd.level1.level2, DotDict)
|
|
182
|
-
self.assertEqual(dd.level1.level2.value, 42)
|
|
183
|
-
|
|
184
|
-
# Test dynamic assignment of nested dict
|
|
185
|
-
dd.new_nested = {'a': {'b': 1}}
|
|
186
|
-
self.assertIsInstance(dd.new_nested, DotDict)
|
|
187
|
-
self.assertIsInstance(dd.new_nested.a, DotDict)
|
|
188
|
-
|
|
189
|
-
async def testReprMethod(self):
|
|
190
|
-
"""
|
|
191
|
-
Test the string representation of DotDict.
|
|
192
|
-
|
|
193
|
-
Verifies that the `__repr__` method of DotDict returns a string
|
|
194
|
-
representation that includes the DotDict prefix.
|
|
195
|
-
|
|
196
|
-
Returns
|
|
197
|
-
-------
|
|
198
|
-
None
|
|
199
|
-
"""
|
|
200
|
-
# Create a DotDict instance and test its string representation
|
|
201
|
-
dd = DotDict({'key': 'value'})
|
|
202
|
-
self.assertEqual(repr(dd), "{'key': 'value'}")
|
tests/testing/__init__.py
DELETED
|
File without changes
|
tests/testing/cases/__init__.py
DELETED
|
File without changes
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
2
|
-
import inspect
|
|
3
|
-
|
|
4
|
-
class TestAsyncTestCase(AsyncTestCase):
|
|
5
|
-
|
|
6
|
-
async def testMethodsExist(self):
|
|
7
|
-
"""
|
|
8
|
-
Verify that AsyncTestCase defines the required asynchronous lifecycle methods.
|
|
9
|
-
|
|
10
|
-
Parameters
|
|
11
|
-
----------
|
|
12
|
-
self : TestAsyncTestCase
|
|
13
|
-
Instance of the test case.
|
|
14
|
-
|
|
15
|
-
Returns
|
|
16
|
-
-------
|
|
17
|
-
None
|
|
18
|
-
This method does not return a value.
|
|
19
|
-
|
|
20
|
-
Raises
|
|
21
|
-
------
|
|
22
|
-
AssertionError
|
|
23
|
-
If any of the required methods do not exist in AsyncTestCase.
|
|
24
|
-
"""
|
|
25
|
-
required_methods = [
|
|
26
|
-
"asyncSetUp",
|
|
27
|
-
"asyncTearDown",
|
|
28
|
-
"onAsyncSetup",
|
|
29
|
-
"onAsyncTeardown"
|
|
30
|
-
]
|
|
31
|
-
# Assert that each required method exists in AsyncTestCase
|
|
32
|
-
for method_name in required_methods:
|
|
33
|
-
self.assertTrue(hasattr(AsyncTestCase, method_name), f"{method_name} does not exist")
|
|
34
|
-
|
|
35
|
-
async def testMethodsAreCoroutines(self):
|
|
36
|
-
"""
|
|
37
|
-
Check that all required asynchronous lifecycle methods in AsyncTestCase are coroutine functions.
|
|
38
|
-
|
|
39
|
-
Parameters
|
|
40
|
-
----------
|
|
41
|
-
self : TestAsyncTestCase
|
|
42
|
-
Instance of the test case.
|
|
43
|
-
|
|
44
|
-
Returns
|
|
45
|
-
-------
|
|
46
|
-
None
|
|
47
|
-
This method does not return a value.
|
|
48
|
-
|
|
49
|
-
Raises
|
|
50
|
-
------
|
|
51
|
-
AssertionError
|
|
52
|
-
If any of the required methods are not coroutine functions.
|
|
53
|
-
"""
|
|
54
|
-
required_methods = [
|
|
55
|
-
"asyncSetUp",
|
|
56
|
-
"asyncTearDown",
|
|
57
|
-
"onAsyncSetup",
|
|
58
|
-
"onAsyncTeardown"
|
|
59
|
-
]
|
|
60
|
-
# Assert that each required method is a coroutine function
|
|
61
|
-
for method_name in required_methods:
|
|
62
|
-
method = getattr(AsyncTestCase, method_name)
|
|
63
|
-
self.assertTrue(inspect.iscoroutinefunction(method), f"{method_name} is not a coroutine function")
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
2
|
-
from orionis.test.cases.synchronous import SyncTestCase
|
|
3
|
-
import inspect
|
|
4
|
-
|
|
5
|
-
class TestSyncTestCase(AsyncTestCase):
|
|
6
|
-
|
|
7
|
-
async def testHasMethods(self):
|
|
8
|
-
"""
|
|
9
|
-
Verify that SyncTestCase defines the required synchronous lifecycle methods.
|
|
10
|
-
|
|
11
|
-
This method asserts the presence of the following methods in SyncTestCase:
|
|
12
|
-
- setUp
|
|
13
|
-
- tearDown
|
|
14
|
-
- onSetup
|
|
15
|
-
- onTeardown
|
|
16
|
-
|
|
17
|
-
Returns
|
|
18
|
-
-------
|
|
19
|
-
None
|
|
20
|
-
"""
|
|
21
|
-
# Assert that SyncTestCase has a setUp method
|
|
22
|
-
self.assertTrue(hasattr(SyncTestCase, "setUp"))
|
|
23
|
-
|
|
24
|
-
# Assert that SyncTestCase has a tearDown method
|
|
25
|
-
self.assertTrue(hasattr(SyncTestCase, "tearDown"))
|
|
26
|
-
|
|
27
|
-
# Assert that SyncTestCase has an onSetup method
|
|
28
|
-
self.assertTrue(hasattr(SyncTestCase, "onSetup"))
|
|
29
|
-
|
|
30
|
-
# Assert that SyncTestCase has an onTeardown method
|
|
31
|
-
self.assertTrue(hasattr(SyncTestCase, "onTeardown"))
|
|
32
|
-
|
|
33
|
-
async def testMethodsAreNotCoroutines(self):
|
|
34
|
-
"""
|
|
35
|
-
Ensure that the lifecycle methods of SyncTestCase are synchronous functions.
|
|
36
|
-
|
|
37
|
-
This method checks that the following methods are not coroutine functions:
|
|
38
|
-
- setUp
|
|
39
|
-
- tearDown
|
|
40
|
-
- onSetup
|
|
41
|
-
- onTeardown
|
|
42
|
-
|
|
43
|
-
Returns
|
|
44
|
-
-------
|
|
45
|
-
None
|
|
46
|
-
"""
|
|
47
|
-
# Assert that setUp is not a coroutine function
|
|
48
|
-
self.assertFalse(inspect.iscoroutinefunction(SyncTestCase.setUp))
|
|
49
|
-
|
|
50
|
-
# Assert that tearDown is not a coroutine function
|
|
51
|
-
self.assertFalse(inspect.iscoroutinefunction(SyncTestCase.tearDown))
|
|
52
|
-
|
|
53
|
-
# Assert that onSetup is not a coroutine function
|
|
54
|
-
self.assertFalse(inspect.iscoroutinefunction(SyncTestCase.onSetup))
|
|
55
|
-
|
|
56
|
-
# Assert that onTeardown is not a coroutine function
|
|
57
|
-
self.assertFalse(inspect.iscoroutinefunction(SyncTestCase.onTeardown))
|
|
File without changes
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
2
|
-
from orionis.test.entities.result import TestResult
|
|
3
|
-
from orionis.test.enums import TestStatus
|
|
4
|
-
|
|
5
|
-
class TestTestingResult(AsyncTestCase):
|
|
6
|
-
|
|
7
|
-
async def testDefaultValues(self) -> None:
|
|
8
|
-
"""
|
|
9
|
-
Test that optional fields in TestResult are set to None by default.
|
|
10
|
-
|
|
11
|
-
Checks that the fields `error_message`, `traceback`, `class_name`, `method`, `module`, and `file_path`
|
|
12
|
-
are None when not provided during initialization.
|
|
13
|
-
|
|
14
|
-
Parameters
|
|
15
|
-
----------
|
|
16
|
-
self : TestTestingResult
|
|
17
|
-
The test case instance.
|
|
18
|
-
|
|
19
|
-
Returns
|
|
20
|
-
-------
|
|
21
|
-
None
|
|
22
|
-
"""
|
|
23
|
-
# Create a TestResult instance with only required fields
|
|
24
|
-
result = TestResult(
|
|
25
|
-
id=1,
|
|
26
|
-
name="Sample Test",
|
|
27
|
-
status=TestStatus.PASSED,
|
|
28
|
-
execution_time=0.5
|
|
29
|
-
)
|
|
30
|
-
# Assert that all optional fields are set to None by default
|
|
31
|
-
self.assertIsNone(result.error_message)
|
|
32
|
-
self.assertIsNone(result.traceback)
|
|
33
|
-
self.assertIsNone(result.class_name)
|
|
34
|
-
self.assertIsNone(result.method)
|
|
35
|
-
self.assertIsNone(result.module)
|
|
36
|
-
self.assertIsNone(result.file_path)
|
|
37
|
-
|
|
38
|
-
async def testRequiredFields(self) -> None:
|
|
39
|
-
"""
|
|
40
|
-
Test that TestResult enforces required fields during initialization.
|
|
41
|
-
|
|
42
|
-
Verifies that omitting required fields raises a TypeError.
|
|
43
|
-
|
|
44
|
-
Parameters
|
|
45
|
-
----------
|
|
46
|
-
self : TestTestingResult
|
|
47
|
-
The test case instance.
|
|
48
|
-
|
|
49
|
-
Returns
|
|
50
|
-
-------
|
|
51
|
-
None
|
|
52
|
-
"""
|
|
53
|
-
# Attempt to create TestResult with no arguments; should raise TypeError
|
|
54
|
-
with self.assertRaises(TypeError):
|
|
55
|
-
TestResult() # Missing all required fields
|
|
56
|
-
|
|
57
|
-
# Attempt to create TestResult missing the 'id' field; should raise TypeError
|
|
58
|
-
with self.assertRaises(TypeError):
|
|
59
|
-
TestResult(
|
|
60
|
-
name="Sample Test",
|
|
61
|
-
status=TestStatus.PASSED,
|
|
62
|
-
execution_time=0.5
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
async def testImmutable(self) -> None:
|
|
66
|
-
"""
|
|
67
|
-
Test that TestResult instances are immutable.
|
|
68
|
-
|
|
69
|
-
Ensures that modifying an attribute of a TestResult instance raises an exception.
|
|
70
|
-
|
|
71
|
-
Parameters
|
|
72
|
-
----------
|
|
73
|
-
self : TestTestingResult
|
|
74
|
-
The test case instance.
|
|
75
|
-
|
|
76
|
-
Returns
|
|
77
|
-
-------
|
|
78
|
-
None
|
|
79
|
-
"""
|
|
80
|
-
# Create a TestResult instance
|
|
81
|
-
result = TestResult(
|
|
82
|
-
id=1,
|
|
83
|
-
name="Sample Test",
|
|
84
|
-
status=TestStatus.PASSED,
|
|
85
|
-
execution_time=0.5
|
|
86
|
-
)
|
|
87
|
-
# Attempt to modify an attribute; should raise an exception due to immutability
|
|
88
|
-
with self.assertRaises(Exception):
|
|
89
|
-
result.name = "Modified Name"
|
|
90
|
-
|
|
91
|
-
async def testStatusValues(self) -> None:
|
|
92
|
-
"""
|
|
93
|
-
Test that all TestStatus enum values can be assigned to TestResult.
|
|
94
|
-
|
|
95
|
-
Iterates through each TestStatus value and checks assignment to the status field.
|
|
96
|
-
|
|
97
|
-
Parameters
|
|
98
|
-
----------
|
|
99
|
-
self : TestTestingResult
|
|
100
|
-
The test case instance.
|
|
101
|
-
|
|
102
|
-
Returns
|
|
103
|
-
-------
|
|
104
|
-
None
|
|
105
|
-
"""
|
|
106
|
-
# Iterate through all possible TestStatus values
|
|
107
|
-
for status in TestStatus:
|
|
108
|
-
# Create a TestResult instance with the current status
|
|
109
|
-
result = TestResult(
|
|
110
|
-
id=1,
|
|
111
|
-
name="Status Test",
|
|
112
|
-
status=status,
|
|
113
|
-
execution_time=0.1
|
|
114
|
-
)
|
|
115
|
-
# Assert that the status field matches the assigned value
|
|
116
|
-
self.assertEqual(result.status, status)
|
|
117
|
-
|
|
118
|
-
async def testErrorFields(self) -> None:
|
|
119
|
-
"""
|
|
120
|
-
Test that error_message and traceback fields are stored correctly in TestResult.
|
|
121
|
-
|
|
122
|
-
Verifies that providing values for error_message and traceback sets them as expected.
|
|
123
|
-
|
|
124
|
-
Parameters
|
|
125
|
-
----------
|
|
126
|
-
self : TestTestingResult
|
|
127
|
-
The test case instance.
|
|
128
|
-
|
|
129
|
-
Returns
|
|
130
|
-
-------
|
|
131
|
-
None
|
|
132
|
-
"""
|
|
133
|
-
error_msg = "Test failed"
|
|
134
|
-
traceback = "Traceback info"
|
|
135
|
-
# Create a TestResult instance with error fields
|
|
136
|
-
result = TestResult(
|
|
137
|
-
id=1,
|
|
138
|
-
name="Failing Test",
|
|
139
|
-
status=TestStatus.FAILED,
|
|
140
|
-
execution_time=0.2,
|
|
141
|
-
error_message=error_msg,
|
|
142
|
-
traceback=traceback
|
|
143
|
-
)
|
|
144
|
-
# Assert that error_message and traceback fields are set correctly
|
|
145
|
-
self.assertEqual(result.error_message, error_msg)
|
|
146
|
-
self.assertEqual(result.traceback, traceback)
|
tests/testing/enums/__init__.py
DELETED
|
File without changes
|