orionis 0.285.0__py3-none-any.whl → 0.287.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/metadata/framework.py +1 -1
- orionis/services/asynchrony/contracts/__init__.py +0 -0
- orionis/services/asynchrony/contracts/coroutines.py +24 -0
- orionis/services/asynchrony/coroutines.py +58 -19
- orionis/services/asynchrony/exceptions/coroutine_exception.py +8 -15
- orionis/services/environment/contracts/env.py +45 -50
- orionis/services/environment/dot_env.py +205 -181
- orionis/services/environment/env.py +68 -85
- orionis/services/environment/exceptions/environment_value_error.py +18 -0
- orionis/services/environment/exceptions/environment_value_exception.py +23 -0
- orionis/services/environment/type_hint.py +559 -0
- orionis/test/exceptions/test_config_exception.py +8 -17
- orionis/test/exceptions/test_failure_exception.py +27 -27
- orionis/test/exceptions/test_persistence_error.py +10 -20
- orionis/test/exceptions/test_runtime_error.py +8 -15
- orionis/test/exceptions/test_value_error.py +8 -15
- orionis/test/logs/history.py +3 -5
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/METADATA +1 -1
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/RECORD +66 -62
- tests/example/test_example.py +5 -2
- tests/foundation/config/app/test_app.py +13 -3
- tests/foundation/config/auth/test_auth.py +9 -4
- tests/foundation/config/cache/test_cache.py +60 -15
- tests/foundation/config/cache/test_cache_file.py +62 -14
- tests/foundation/config/cache/test_cache_stores.py +74 -14
- tests/foundation/config/cors/test_cors.py +102 -33
- tests/foundation/config/database/test_database.py +38 -14
- tests/foundation/config/database/test_database_connections.py +79 -5
- tests/foundation/config/database/test_database_mysql.py +138 -15
- tests/foundation/config/database/test_database_oracle.py +110 -26
- tests/foundation/config/database/test_database_pgsql.py +96 -26
- tests/foundation/config/database/test_database_sqlite.py +56 -2
- tests/foundation/config/exceptions/test_exceptions_integrity.py +44 -10
- tests/foundation/config/filesystems/test_filesystems.py +64 -14
- tests/foundation/config/filesystems/test_filesystems_aws.py +45 -7
- tests/foundation/config/filesystems/test_filesystems_disks.py +78 -8
- tests/foundation/config/filesystems/test_filesystems_local.py +66 -18
- tests/foundation/config/filesystems/test_filesystems_public.py +37 -0
- tests/foundation/config/logging/test_logging.py +75 -11
- tests/foundation/config/logging/test_logging_channels.py +79 -2
- tests/foundation/config/logging/test_logging_chunked.py +85 -12
- tests/foundation/config/logging/test_logging_daily.py +79 -12
- tests/foundation/config/logging/test_logging_hourly.py +68 -2
- tests/foundation/config/logging/test_logging_monthly.py +48 -2
- tests/foundation/config/logging/test_logging_stack.py +49 -14
- tests/foundation/config/logging/test_logging_weekly.py +92 -2
- tests/foundation/config/mail/test_mail.py +87 -15
- tests/foundation/config/mail/test_mail_file.py +40 -4
- tests/foundation/config/mail/test_mail_mailers.py +56 -8
- tests/foundation/config/mail/test_mail_smtp.py +58 -14
- tests/foundation/config/queue/test_queue.py +62 -9
- tests/foundation/config/queue/test_queue_brokers.py +27 -10
- tests/foundation/config/queue/test_queue_database.py +53 -15
- tests/foundation/config/root/test_root_paths.py +69 -2
- tests/foundation/config/session/test_session.py +30 -1
- tests/foundation/config/startup/test_config_startup.py +77 -7
- tests/foundation/config/testing/test_testing.py +68 -0
- tests/patterns/singleton/test_singleton.py +10 -1
- tests/services/asynchrony/test_async_io.py +4 -4
- tests/services/environment/test_env.py +3 -4
- tests/testing/test_testing_result.py +56 -19
- tests/testing/test_testing_unit.py +93 -24
- orionis/services/environment/exceptions/value_exception.py +0 -27
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/WHEEL +0 -0
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/top_level.txt +0 -0
- {orionis-0.285.0.dist-info → orionis-0.287.0.dist-info}/zip-safe +0 -0
@@ -5,25 +5,60 @@ from orionis.unittesting import TestCase, UnittestMock
|
|
5
5
|
|
6
6
|
class TestConfiguration(TestCase):
|
7
7
|
"""
|
8
|
-
Test suite for the Configuration dataclass
|
9
|
-
configuration sections for the application.
|
8
|
+
Test suite for the Configuration dataclass.
|
10
9
|
|
11
|
-
This
|
12
|
-
|
10
|
+
This class contains unit tests to verify the correct behavior of the
|
11
|
+
Configuration dataclass, including initialization, type validation,
|
12
|
+
dictionary conversion, metadata accessibility, mutability, and equality.
|
13
|
+
|
14
|
+
Attributes
|
15
|
+
----------
|
16
|
+
None
|
17
|
+
|
18
|
+
Methods
|
19
|
+
-------
|
20
|
+
testConfigurationIsDataclass()
|
21
|
+
Test that Configuration is properly defined as a dataclass.
|
22
|
+
testDefaultInitialization()
|
23
|
+
Test that Configuration can be initialized with default values.
|
24
|
+
testAllSectionsHaveDefaultFactories()
|
25
|
+
Test that all configuration sections have default factories.
|
26
|
+
testTypeValidationInPostInit()
|
27
|
+
Test that __post_init__ validates types correctly.
|
28
|
+
testToDictReturnsCompleteDictionary()
|
29
|
+
Test that toDict() returns a complete dictionary representation.
|
30
|
+
testToDictReturnsNestedStructures()
|
31
|
+
Test that toDict() properly converts nested dataclasses.
|
32
|
+
testMetadataIsAccessible()
|
33
|
+
Test that field metadata is properly defined and accessible.
|
34
|
+
testConfigurationIsMutable()
|
35
|
+
Test that Configuration is mutable (not frozen).
|
36
|
+
testConfigurationEquality()
|
37
|
+
Test that Configuration instances with same values are equal.
|
13
38
|
"""
|
14
39
|
|
15
40
|
def testConfigurationIsDataclass(self):
|
16
41
|
"""
|
17
42
|
Test that Configuration is properly defined as a dataclass.
|
18
|
-
|
43
|
+
|
44
|
+
Ensures that the @dataclass decorator was applied correctly.
|
45
|
+
|
46
|
+
Returns
|
47
|
+
-------
|
48
|
+
None
|
19
49
|
"""
|
20
50
|
self.assertTrue(is_dataclass(Configuration))
|
21
51
|
|
22
52
|
def testDefaultInitialization(self):
|
23
53
|
"""
|
24
54
|
Test that Configuration can be initialized with default values.
|
25
|
-
|
26
|
-
|
55
|
+
|
56
|
+
Verifies that all default factories work correctly and the instance
|
57
|
+
is properly constructed.
|
58
|
+
|
59
|
+
Returns
|
60
|
+
-------
|
61
|
+
None
|
27
62
|
"""
|
28
63
|
config = Configuration()
|
29
64
|
self.assertIsInstance(config, Configuration)
|
@@ -31,8 +66,13 @@ class TestConfiguration(TestCase):
|
|
31
66
|
def testAllSectionsHaveDefaultFactories(self):
|
32
67
|
"""
|
33
68
|
Test that all configuration sections have default factories.
|
69
|
+
|
34
70
|
Verifies that each field in the Configuration class has a
|
35
71
|
default_factory specified.
|
72
|
+
|
73
|
+
Returns
|
74
|
+
-------
|
75
|
+
None
|
36
76
|
"""
|
37
77
|
config = Configuration()
|
38
78
|
for field in config.__dataclass_fields__.values():
|
@@ -42,8 +82,13 @@ class TestConfiguration(TestCase):
|
|
42
82
|
def testTypeValidationInPostInit(self):
|
43
83
|
"""
|
44
84
|
Test that __post_init__ validates types correctly.
|
85
|
+
|
45
86
|
Verifies that the type checking for each configuration section
|
46
87
|
works as expected.
|
88
|
+
|
89
|
+
Returns
|
90
|
+
-------
|
91
|
+
None
|
47
92
|
"""
|
48
93
|
# Test with all correct types (should not raise)
|
49
94
|
try:
|
@@ -76,8 +121,13 @@ class TestConfiguration(TestCase):
|
|
76
121
|
def testToDictReturnsCompleteDictionary(self):
|
77
122
|
"""
|
78
123
|
Test that toDict() returns a complete dictionary representation.
|
124
|
+
|
79
125
|
Verifies that the returned dictionary contains all configuration
|
80
126
|
sections with their current values.
|
127
|
+
|
128
|
+
Returns
|
129
|
+
-------
|
130
|
+
None
|
81
131
|
"""
|
82
132
|
config = Configuration()
|
83
133
|
config_dict = config.toDict()
|
@@ -89,8 +139,13 @@ class TestConfiguration(TestCase):
|
|
89
139
|
def testToDictReturnsNestedStructures(self):
|
90
140
|
"""
|
91
141
|
Test that toDict() properly converts nested dataclasses.
|
142
|
+
|
92
143
|
Verifies that the dictionary conversion works recursively for
|
93
144
|
all nested configuration sections.
|
145
|
+
|
146
|
+
Returns
|
147
|
+
-------
|
148
|
+
None
|
94
149
|
"""
|
95
150
|
config = Configuration()
|
96
151
|
config_dict = config.toDict()
|
@@ -101,8 +156,13 @@ class TestConfiguration(TestCase):
|
|
101
156
|
def testMetadataIsAccessible(self):
|
102
157
|
"""
|
103
158
|
Test that field metadata is properly defined and accessible.
|
159
|
+
|
104
160
|
Verifies that each configuration section field has the expected
|
105
161
|
metadata structure with description.
|
162
|
+
|
163
|
+
Returns
|
164
|
+
-------
|
165
|
+
None
|
106
166
|
"""
|
107
167
|
config = Configuration()
|
108
168
|
for field in config.__dataclass_fields__.values():
|
@@ -113,8 +173,13 @@ class TestConfiguration(TestCase):
|
|
113
173
|
def testConfigurationIsMutable(self):
|
114
174
|
"""
|
115
175
|
Test that Configuration is mutable (not frozen).
|
176
|
+
|
116
177
|
Verifies that attributes can be modified after creation since
|
117
178
|
the dataclass isn't marked as frozen.
|
179
|
+
|
180
|
+
Returns
|
181
|
+
-------
|
182
|
+
None
|
118
183
|
"""
|
119
184
|
config = Configuration()
|
120
185
|
new_paths = config.paths.__class__()
|
@@ -127,7 +192,12 @@ class TestConfiguration(TestCase):
|
|
127
192
|
def testConfigurationEquality(self):
|
128
193
|
"""
|
129
194
|
Test that Configuration instances with same values are equal.
|
195
|
+
|
130
196
|
Verifies that dataclass equality comparison works as expected.
|
197
|
+
|
198
|
+
Returns
|
199
|
+
-------
|
200
|
+
None
|
131
201
|
"""
|
132
202
|
config1 = Configuration()
|
133
203
|
config2 = Configuration()
|
@@ -4,10 +4,21 @@ from orionis.test.enums.test_mode import ExecutionMode
|
|
4
4
|
from orionis.unittesting import TestCase
|
5
5
|
|
6
6
|
class TestTestingConfig(TestCase):
|
7
|
+
"""
|
8
|
+
Test suite for the Testing configuration entity.
|
9
|
+
|
10
|
+
This class contains asynchronous test cases to validate the default values,
|
11
|
+
custom values, and integrity constraints of the Testing configuration.
|
12
|
+
"""
|
7
13
|
|
8
14
|
async def testDefaultValues(self):
|
9
15
|
"""
|
10
16
|
Test the default values of the Testing configuration.
|
17
|
+
|
18
|
+
Notes
|
19
|
+
-----
|
20
|
+
Ensures that all default attributes of the Testing configuration are set
|
21
|
+
as expected.
|
11
22
|
"""
|
12
23
|
t = Testing()
|
13
24
|
self.assertEqual(t.verbosity, 2)
|
@@ -25,6 +36,11 @@ class TestTestingConfig(TestCase):
|
|
25
36
|
async def testValidCustomValues(self):
|
26
37
|
"""
|
27
38
|
Test custom valid values for all fields.
|
39
|
+
|
40
|
+
Notes
|
41
|
+
-----
|
42
|
+
Verifies that the Testing configuration accepts and correctly sets
|
43
|
+
custom valid values for all its fields.
|
28
44
|
"""
|
29
45
|
t = Testing(
|
30
46
|
verbosity=1,
|
@@ -54,6 +70,10 @@ class TestTestingConfig(TestCase):
|
|
54
70
|
async def testFolderPathStringAndList(self):
|
55
71
|
"""
|
56
72
|
Test folder_path accepts both string and list of strings.
|
73
|
+
|
74
|
+
Notes
|
75
|
+
-----
|
76
|
+
Checks that the folder_path attribute can be set as a string or a list of strings.
|
57
77
|
"""
|
58
78
|
t1 = Testing(folder_path="integration")
|
59
79
|
self.assertEqual(t1.folder_path, "integration")
|
@@ -63,6 +83,10 @@ class TestTestingConfig(TestCase):
|
|
63
83
|
async def testTagsNoneOrList(self):
|
64
84
|
"""
|
65
85
|
Test tags accepts None or list of strings.
|
86
|
+
|
87
|
+
Notes
|
88
|
+
-----
|
89
|
+
Ensures that the tags attribute can be set to None or a list of strings.
|
66
90
|
"""
|
67
91
|
t1 = Testing(tags=None)
|
68
92
|
self.assertIsNone(t1.tags)
|
@@ -72,6 +96,10 @@ class TestTestingConfig(TestCase):
|
|
72
96
|
async def testInvalidVerbosity(self):
|
73
97
|
"""
|
74
98
|
Test invalid verbosity values.
|
99
|
+
|
100
|
+
Notes
|
101
|
+
-----
|
102
|
+
Verifies that invalid verbosity values raise OrionisIntegrityException.
|
75
103
|
"""
|
76
104
|
with self.assertRaises(OrionisIntegrityException):
|
77
105
|
Testing(verbosity=-1)
|
@@ -83,6 +111,10 @@ class TestTestingConfig(TestCase):
|
|
83
111
|
async def testInvalidExecutionMode(self):
|
84
112
|
"""
|
85
113
|
Test execution_mode cannot be None.
|
114
|
+
|
115
|
+
Notes
|
116
|
+
-----
|
117
|
+
Ensures that setting execution_mode to None raises OrionisIntegrityException.
|
86
118
|
"""
|
87
119
|
with self.assertRaises(OrionisIntegrityException):
|
88
120
|
Testing(execution_mode=None)
|
@@ -90,6 +122,10 @@ class TestTestingConfig(TestCase):
|
|
90
122
|
async def testInvalidMaxWorkers(self):
|
91
123
|
"""
|
92
124
|
Test invalid max_workers values.
|
125
|
+
|
126
|
+
Notes
|
127
|
+
-----
|
128
|
+
Checks that invalid values for max_workers raise OrionisIntegrityException.
|
93
129
|
"""
|
94
130
|
with self.assertRaises(OrionisIntegrityException):
|
95
131
|
Testing(max_workers=0)
|
@@ -101,6 +137,10 @@ class TestTestingConfig(TestCase):
|
|
101
137
|
async def testInvalidFailFast(self):
|
102
138
|
"""
|
103
139
|
Test fail_fast must be boolean.
|
140
|
+
|
141
|
+
Notes
|
142
|
+
-----
|
143
|
+
Ensures that non-boolean values for fail_fast raise OrionisIntegrityException.
|
104
144
|
"""
|
105
145
|
with self.assertRaises(OrionisIntegrityException):
|
106
146
|
Testing(fail_fast="yes")
|
@@ -108,6 +148,10 @@ class TestTestingConfig(TestCase):
|
|
108
148
|
async def testInvalidPrintResult(self):
|
109
149
|
"""
|
110
150
|
Test print_result must be boolean.
|
151
|
+
|
152
|
+
Notes
|
153
|
+
-----
|
154
|
+
Ensures that non-boolean values for print_result raise OrionisIntegrityException.
|
111
155
|
"""
|
112
156
|
with self.assertRaises(OrionisIntegrityException):
|
113
157
|
Testing(print_result=1)
|
@@ -115,6 +159,10 @@ class TestTestingConfig(TestCase):
|
|
115
159
|
async def testInvalidThrowException(self):
|
116
160
|
"""
|
117
161
|
Test throw_exception must be boolean.
|
162
|
+
|
163
|
+
Notes
|
164
|
+
-----
|
165
|
+
Ensures that non-boolean values for throw_exception raise OrionisIntegrityException.
|
118
166
|
"""
|
119
167
|
with self.assertRaises(OrionisIntegrityException):
|
120
168
|
Testing(throw_exception="no")
|
@@ -122,6 +170,10 @@ class TestTestingConfig(TestCase):
|
|
122
170
|
async def testInvalidBasePath(self):
|
123
171
|
"""
|
124
172
|
Test base_path must be string.
|
173
|
+
|
174
|
+
Notes
|
175
|
+
-----
|
176
|
+
Ensures that non-string values for base_path raise OrionisIntegrityException.
|
125
177
|
"""
|
126
178
|
with self.assertRaises(OrionisIntegrityException):
|
127
179
|
Testing(base_path=123)
|
@@ -129,6 +181,10 @@ class TestTestingConfig(TestCase):
|
|
129
181
|
async def testInvalidFolderPath(self):
|
130
182
|
"""
|
131
183
|
Test folder_path must be string or list of strings.
|
184
|
+
|
185
|
+
Notes
|
186
|
+
-----
|
187
|
+
Ensures that invalid types for folder_path raise OrionisIntegrityException.
|
132
188
|
"""
|
133
189
|
with self.assertRaises(OrionisIntegrityException):
|
134
190
|
Testing(folder_path=123)
|
@@ -140,6 +196,10 @@ class TestTestingConfig(TestCase):
|
|
140
196
|
async def testInvalidPattern(self):
|
141
197
|
"""
|
142
198
|
Test pattern must be string.
|
199
|
+
|
200
|
+
Notes
|
201
|
+
-----
|
202
|
+
Ensures that non-string values for pattern raise OrionisIntegrityException.
|
143
203
|
"""
|
144
204
|
with self.assertRaises(OrionisIntegrityException):
|
145
205
|
Testing(pattern=[])
|
@@ -149,6 +209,10 @@ class TestTestingConfig(TestCase):
|
|
149
209
|
async def testInvalidTestNamePattern(self):
|
150
210
|
"""
|
151
211
|
Test test_name_pattern must be string or None.
|
212
|
+
|
213
|
+
Notes
|
214
|
+
-----
|
215
|
+
Ensures that invalid types for test_name_pattern raise OrionisIntegrityException.
|
152
216
|
"""
|
153
217
|
with self.assertRaises(OrionisIntegrityException):
|
154
218
|
Testing(test_name_pattern=[])
|
@@ -158,6 +222,10 @@ class TestTestingConfig(TestCase):
|
|
158
222
|
async def testInvalidTags(self):
|
159
223
|
"""
|
160
224
|
Test tags must be None or list of strings.
|
225
|
+
|
226
|
+
Notes
|
227
|
+
-----
|
228
|
+
Ensures that invalid types for tags raise OrionisIntegrityException.
|
161
229
|
"""
|
162
230
|
with self.assertRaises(OrionisIntegrityException):
|
163
231
|
Testing(tags="fast")
|
@@ -2,10 +2,19 @@ from orionis.patterns.singleton.meta_class import Singleton
|
|
2
2
|
from orionis.test.cases.test_case import TestCase
|
3
3
|
|
4
4
|
class TestsAsyncCoroutine(TestCase):
|
5
|
+
"""
|
6
|
+
Test cases for the Singleton metaclass.
|
7
|
+
|
8
|
+
This class contains asynchronous test methods to verify the correct behavior
|
9
|
+
of the Singleton metaclass, ensuring that only one instance of a class is created.
|
10
|
+
"""
|
5
11
|
|
6
12
|
async def testSingleton(self):
|
7
13
|
"""
|
8
|
-
Test the Singleton metaclass
|
14
|
+
Test the Singleton metaclass.
|
15
|
+
|
16
|
+
Ensures that only one instance of a class using the Singleton metaclass is created,
|
17
|
+
regardless of how many times the class is instantiated.
|
9
18
|
"""
|
10
19
|
class SingletonClass(metaclass=Singleton):
|
11
20
|
def __init__(self, value):
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
from orionis.services.asynchrony.coroutines import
|
2
|
+
from orionis.services.asynchrony.coroutines import Coroutine
|
3
3
|
from orionis.services.asynchrony.exceptions.coroutine_exception import OrionisCoroutineException
|
4
4
|
from orionis.unittesting import TestCase
|
5
5
|
|
@@ -14,7 +14,7 @@ class TestsAsyncIO(TestCase):
|
|
14
14
|
async def sample_coroutine():
|
15
15
|
return "Hello, World!"
|
16
16
|
|
17
|
-
result = await
|
17
|
+
result = await Coroutine(sample_coroutine()).run()
|
18
18
|
self.assertEqual(result, "Hello, World!")
|
19
19
|
|
20
20
|
def testExecuteWithoutActiveEventLoop(self):
|
@@ -25,7 +25,7 @@ class TestsAsyncIO(TestCase):
|
|
25
25
|
async def sample_coroutine():
|
26
26
|
return "Hello, World!"
|
27
27
|
|
28
|
-
result =
|
28
|
+
result = Coroutine(sample_coroutine()).run()
|
29
29
|
self.assertEqual(result, "Hello, World!")
|
30
30
|
|
31
31
|
def testExecuteWithNonCoroutine(self):
|
@@ -37,4 +37,4 @@ class TestsAsyncIO(TestCase):
|
|
37
37
|
return "Hello, World!"
|
38
38
|
|
39
39
|
with self.assertRaises(OrionisCoroutineException):
|
40
|
-
|
40
|
+
Coroutine(sample_no_coroutine())
|
@@ -12,10 +12,9 @@ class TestEnv(TestCase):
|
|
12
12
|
Test that the get method retrieves values correctly.
|
13
13
|
Verifies that Env.get() properly delegates to DotEnv.get() and returns the expected value.
|
14
14
|
"""
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
self.assertEqual(result, 'test_value')
|
15
|
+
|
16
|
+
# Set test key in.env
|
17
|
+
Env.set('TEST_KEY', 'test_value')
|
19
18
|
|
20
19
|
async def testGetMethodWithDefault(self):
|
21
20
|
"""
|
@@ -1,16 +1,25 @@
|
|
1
|
-
|
2
1
|
from orionis.unittesting import TestCase, TestResult, TestStatus
|
3
2
|
|
4
3
|
class TestTestResult(TestCase):
|
5
|
-
"""
|
6
|
-
Test cases for the TestResult dataclass.
|
7
|
-
"""
|
8
4
|
|
9
|
-
async def testDefaultValues(self):
|
5
|
+
async def testDefaultValues(self) -> None:
|
10
6
|
"""
|
11
|
-
|
7
|
+
Ensures that when optional fields are not provided during initialization of a TestResult
|
8
|
+
instance, they are set to None.
|
9
|
+
|
10
|
+
Notes
|
11
|
+
-----
|
12
|
+
This test verifies the default behavior of the following optional fields:
|
13
|
+
- error_message
|
14
|
+
- traceback
|
15
|
+
- class_name
|
16
|
+
- method
|
17
|
+
- module
|
18
|
+
- file_path
|
12
19
|
|
13
|
-
|
20
|
+
Assertions
|
21
|
+
----------
|
22
|
+
Each optional field is checked to confirm it is None after initialization.
|
14
23
|
"""
|
15
24
|
result = TestResult(
|
16
25
|
id=1,
|
@@ -25,11 +34,16 @@ class TestTestResult(TestCase):
|
|
25
34
|
self.assertIsNone(result.module)
|
26
35
|
self.assertIsNone(result.file_path)
|
27
36
|
|
28
|
-
async def testRequiredFields(self):
|
37
|
+
async def testRequiredFields(self) -> None:
|
29
38
|
"""
|
30
|
-
Test that TestResult
|
39
|
+
Test that TestResult enforces the presence of all required (non-optional) fields during initialization.
|
40
|
+
This test verifies that omitting any required field when creating a TestResult instance raises a TypeError.
|
31
41
|
|
32
|
-
|
42
|
+
Notes
|
43
|
+
-----
|
44
|
+
- Attempts to instantiate TestResult with no arguments.
|
45
|
+
- Attempts to instantiate TestResult missing the 'id' field.
|
46
|
+
- Expects a TypeError to be raised in both cases.
|
33
47
|
"""
|
34
48
|
with self.assertRaises(TypeError):
|
35
49
|
TestResult() # Missing all required fields
|
@@ -42,11 +56,21 @@ class TestTestResult(TestCase):
|
|
42
56
|
execution_time=0.5
|
43
57
|
)
|
44
58
|
|
45
|
-
async def testImmutable(self):
|
59
|
+
async def testImmutable(self) -> None:
|
46
60
|
"""
|
47
|
-
Test
|
61
|
+
Test the immutability of TestResult instances.
|
62
|
+
This test ensures that TestResult, implemented as a frozen dataclass, does not allow
|
63
|
+
modification of its attributes after instantiation.
|
64
|
+
|
65
|
+
Parameters
|
66
|
+
----------
|
67
|
+
self : TestCase
|
68
|
+
The test case instance.
|
48
69
|
|
49
|
-
|
70
|
+
Raises
|
71
|
+
------
|
72
|
+
FrozenInstanceError
|
73
|
+
If an attempt is made to modify an attribute of a frozen TestResult instance.
|
50
74
|
"""
|
51
75
|
result = TestResult(
|
52
76
|
id=1,
|
@@ -57,11 +81,18 @@ class TestTestResult(TestCase):
|
|
57
81
|
with self.assertRaises(Exception):
|
58
82
|
result.name = "Modified Name"
|
59
83
|
|
60
|
-
async def testStatusValues(self):
|
84
|
+
async def testStatusValues(self) -> None:
|
61
85
|
"""
|
62
|
-
|
86
|
+
Parameters
|
87
|
+
----------
|
88
|
+
self : TestCase
|
89
|
+
The test case instance.
|
63
90
|
|
64
|
-
|
91
|
+
Notes
|
92
|
+
-----
|
93
|
+
This test iterates over all possible values of the `TestStatus` enum and verifies
|
94
|
+
that each value can be assigned to the `status` field of a `TestResult` instance.
|
95
|
+
It asserts that the assigned status matches the expected value.
|
65
96
|
"""
|
66
97
|
for status in TestStatus:
|
67
98
|
result = TestResult(
|
@@ -72,11 +103,17 @@ class TestTestResult(TestCase):
|
|
72
103
|
)
|
73
104
|
self.assertEqual(result.status, status)
|
74
105
|
|
75
|
-
async def testErrorFields(self):
|
106
|
+
async def testErrorFields(self) -> None:
|
76
107
|
"""
|
77
|
-
|
108
|
+
Parameters
|
109
|
+
----------
|
110
|
+
self : TestCase
|
111
|
+
The test case instance.
|
78
112
|
|
79
|
-
|
113
|
+
Notes
|
114
|
+
-----
|
115
|
+
Verifies that the `error_message` and `traceback` fields are correctly stored in the `TestResult`
|
116
|
+
object when provided during initialization.
|
80
117
|
"""
|
81
118
|
error_msg = "Test failed"
|
82
119
|
traceback = "Traceback info"
|