orionis 0.216.0__py3-none-any.whl → 0.218.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/framework.py +2 -2
- orionis/luminate/test/test_case.py +58 -1
- orionis/luminate/test/test_std_out.py +1 -1
- {orionis-0.216.0.dist-info → orionis-0.218.0.dist-info}/METADATA +1 -1
- {orionis-0.216.0.dist-info → orionis-0.218.0.dist-info}/RECORD +16 -16
- tests/support/inspection/test_reflection_abstract.py +21 -21
- tests/support/inspection/test_reflection_concrete.py +20 -20
- tests/support/inspection/test_reflection_concrete_with_abstract.py +5 -5
- tests/support/inspection/test_reflection_instance.py +26 -23
- tests/support/inspection/test_reflection_instance_with_abstract.py +5 -5
- tests/support/parsers/test_exception_parser.py +4 -4
- tests/support/standard/test_std.py +18 -14
- {orionis-0.216.0.dist-info → orionis-0.218.0.dist-info}/LICENCE +0 -0
- {orionis-0.216.0.dist-info → orionis-0.218.0.dist-info}/WHEEL +0 -0
- {orionis-0.216.0.dist-info → orionis-0.218.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.216.0.dist-info → orionis-0.218.0.dist-info}/top_level.txt +0 -0
orionis/framework.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
NAME = "orionis"
|
6
6
|
|
7
7
|
# Current version of the framework
|
8
|
-
VERSION = "0.
|
8
|
+
VERSION = "0.218.0"
|
9
9
|
|
10
10
|
# Full name of the author or maintainer of the project
|
11
11
|
AUTHOR = "Raul Mauricio Uñate Castro"
|
@@ -26,7 +26,7 @@ SKELETON = "https://github.com/orionis-framework/skeleton"
|
|
26
26
|
FRAMEWORK = "https://github.com/orionis-framework/framework"
|
27
27
|
|
28
28
|
# URL to the project's documentation
|
29
|
-
DOCS = "https://
|
29
|
+
DOCS = "https://orionis-framework.com/"
|
30
30
|
|
31
31
|
# API URL to the project's JSON data
|
32
32
|
API = "https://pypi.org/pypi/orionis/json"
|
@@ -1,5 +1,62 @@
|
|
1
1
|
import unittest
|
2
2
|
from orionis.luminate.test.test_std_out import TestStdOut
|
3
3
|
|
4
|
-
class TestCase(unittest.
|
4
|
+
class TestCase(unittest.IsolatedAsyncioTestCase, TestStdOut):
|
5
|
+
"""
|
6
|
+
TestCase is a base class for unit tests that provides support for asynchronous
|
7
|
+
testing using `unittest.IsolatedAsyncioTestCase` and additional functionality
|
8
|
+
from `TestStdOut`."""
|
9
|
+
async def asyncSetUp(self):
|
10
|
+
"""
|
11
|
+
Asynchronous setup method called before each test.
|
12
|
+
It ensures that the parent class's asyncSetUp method is invoked to initialize
|
13
|
+
any required resources.
|
14
|
+
"""
|
15
|
+
await super().asyncSetUp()
|
16
|
+
|
17
|
+
async def asyncTearDown(self):
|
18
|
+
"""
|
19
|
+
Asynchronous teardown method called after each test.
|
20
|
+
It ensures that the parent class's asyncTearDown method is invoked to clean up
|
21
|
+
any resources used during the test.
|
22
|
+
"""
|
23
|
+
await super().asyncTearDown()
|
24
|
+
|
25
|
+
# Another asynchronous test case class
|
26
|
+
class TestAsyncCase(unittest.IsolatedAsyncioTestCase, TestStdOut):
|
27
|
+
"""
|
28
|
+
TestAsyncCase is a test case class designed for asynchronous unit testing.
|
29
|
+
It inherits from `unittest.IsolatedAsyncioTestCase` to provide support for
|
30
|
+
async test methods and `TestStdOut` for additional functionality.
|
31
|
+
Methods
|
32
|
+
-------
|
33
|
+
asyncSetUp()
|
34
|
+
Asynchronous setup method called before each test. It ensures that the
|
35
|
+
parent class's asyncSetUp method is invoked to initialize any required
|
36
|
+
resources.
|
37
|
+
asyncTearDown()
|
38
|
+
Asynchronous teardown method called after each test. It ensures that the
|
39
|
+
parent class's asyncTearDown method is invoked to clean up any resources
|
40
|
+
used during the test.
|
41
|
+
"""
|
42
|
+
async def asyncSetUp(self):
|
43
|
+
"""
|
44
|
+
Asynchronous setup method called before each test.
|
45
|
+
It ensures that the parent class's asyncSetUp method is invoked to initialize
|
46
|
+
"""
|
47
|
+
await super().asyncSetUp()
|
48
|
+
|
49
|
+
async def asyncTearDown(self):
|
50
|
+
"""
|
51
|
+
Asynchronous teardown method called after each test.
|
52
|
+
It ensures that the parent class's asyncTearDown method is invoked to clean up
|
53
|
+
"""
|
54
|
+
await super().asyncTearDown()
|
55
|
+
|
56
|
+
class TestSyncCase(unittest.TestCase, TestStdOut):
|
57
|
+
"""
|
58
|
+
TestSyncCase is a test case class designed for synchronous unit testing.
|
59
|
+
It inherits from `unittest.TestCase` to provide support for standard test methods
|
60
|
+
and `TestStdOut` for additional functionality.
|
61
|
+
"""
|
5
62
|
pass
|
@@ -56,7 +56,7 @@ class TestStdOut:
|
|
56
56
|
_line = sys._getframe(1).f_lineno
|
57
57
|
|
58
58
|
# Print the contextual information and the provided arguments
|
59
|
-
Console.textMuted(f"[
|
59
|
+
Console.textMuted(f"[Printout] File: {_file}, Line: {_line}, Method: {_method}")
|
60
60
|
print(*args[1:], end='\n')
|
61
61
|
Console.newLine()
|
62
62
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
orionis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
orionis/console.py,sha256=4gYWxf0fWYgJ4RKwARvnTPh06FL3GJ6SAZ7R2NzOICw,1342
|
3
|
-
orionis/framework.py,sha256=
|
3
|
+
orionis/framework.py,sha256=RK1Wv5laD8Pqih2kN0_l1D5I2dMrABWjgiXk50-BESk,1458
|
4
4
|
orionis/installer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
orionis/installer/manager.py,sha256=Li4TVziRXWfum02xNG4JHwbnLk-u8xzHjdqKz-D894k,2755
|
6
6
|
orionis/installer/output.py,sha256=7O9qa2xtXMB_4ZvVi-Klneom9YazwygAd_4uYAoxhbU,8548
|
@@ -184,11 +184,11 @@ orionis/luminate/support/standard/std.py,sha256=AlhDc0CXC8_TSfZfkodefl_MwCyauX2E
|
|
184
184
|
orionis/luminate/support/standard/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
185
185
|
orionis/luminate/support/standard/contracts/std.py,sha256=x9sVir2yg4hve56cCklIdVSr8utruIO_sUdlTNfZ1Ds,3109
|
186
186
|
orionis/luminate/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
187
|
-
orionis/luminate/test/test_case.py,sha256=
|
187
|
+
orionis/luminate/test/test_case.py,sha256=y3-u3oJtCHLP-DoVW3jan2i96Y78VVdIM1pL7iV0uqU,2508
|
188
188
|
orionis/luminate/test/test_exception.py,sha256=21PILTXnMuL5-wT3HGKjIklt8VeIYDcQDN346i-BbJw,1336
|
189
189
|
orionis/luminate/test/test_result.py,sha256=Px2_M70r_y7BntRITk_h0IPTbSTW5XhDyklMKHm3JJI,999
|
190
190
|
orionis/luminate/test/test_status.py,sha256=vNKRmp1lud_ZGTayf3A8wO_0vEYdFABy_oMw-RcEc1c,673
|
191
|
-
orionis/luminate/test/test_std_out.py,sha256=
|
191
|
+
orionis/luminate/test/test_std_out.py,sha256=evvV3aCIBQaiwCJzM0kFWm6tfpjoTeLUVEXt6x7YOs4,2768
|
192
192
|
orionis/luminate/test/test_suite.py,sha256=eg3OwknndYSNCip_f5twpaJSFrBIuKpZQgUwBORblWA,2218
|
193
193
|
orionis/luminate/test/test_unit.py,sha256=HtPDWzFXpgFwWYej8z2BArU4k5lItH57K_E-l21MBWo,12070
|
194
194
|
orionis/static/ascii/icon.ascii,sha256=IgrlVjcYxcCrr0cJuJkOnEz0aEdAQBTyLzO5ainKsWc,398
|
@@ -205,11 +205,11 @@ tests/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
205
205
|
tests/example/test_example.py,sha256=8EYjl1b-J_479dmJdQoAcKCKr7JUydW7EmPQpeiF13Y,586
|
206
206
|
tests/support/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
207
207
|
tests/support/inspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
208
|
-
tests/support/inspection/test_reflection_abstract.py,sha256=
|
209
|
-
tests/support/inspection/test_reflection_concrete.py,sha256=
|
210
|
-
tests/support/inspection/test_reflection_concrete_with_abstract.py,sha256=
|
211
|
-
tests/support/inspection/test_reflection_instance.py,sha256=
|
212
|
-
tests/support/inspection/test_reflection_instance_with_abstract.py,sha256=
|
208
|
+
tests/support/inspection/test_reflection_abstract.py,sha256=6w8vm8H_fR4Z-KYjQGm8bq-HcetlpQl0EsDmDy3WzQ8,9311
|
209
|
+
tests/support/inspection/test_reflection_concrete.py,sha256=3BWSU7MkFEv2UgAVAwhiaMrzEwAyDBBJCa6edOENKSU,6782
|
210
|
+
tests/support/inspection/test_reflection_concrete_with_abstract.py,sha256=85cV9loDvtLG7sUxD6n_Ja0KV3x8FYakE2Z0W2Iruu8,4680
|
211
|
+
tests/support/inspection/test_reflection_instance.py,sha256=8XKkEhboESLG2UaJ-STJ8STe7mUO4YDkKy01kiiGvkI,7197
|
212
|
+
tests/support/inspection/test_reflection_instance_with_abstract.py,sha256=l6tidHJUJpWhol-E5GfQEpMZ5gIVZFsegwVtMk8tYhs,4089
|
213
213
|
tests/support/inspection/fakes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
214
214
|
tests/support/inspection/fakes/fake_reflection_abstract.py,sha256=7qtz44brfFzE4oNYi9kIsvdWP79nP2FnzSz-0bU__pg,5045
|
215
215
|
tests/support/inspection/fakes/fake_reflection_concrete.py,sha256=j6gzsxE3xq5oJ30H_Hm1RsUwEY3jOYBu4sclxtD1ayo,1047
|
@@ -217,14 +217,14 @@ tests/support/inspection/fakes/fake_reflection_concrete_with_abstract.py,sha256=
|
|
217
217
|
tests/support/inspection/fakes/fake_reflection_instance.py,sha256=G16rZdJWC3L8SGEQkmwktvw4n7IAusIIx9Tm-ZFLcg4,1419
|
218
218
|
tests/support/inspection/fakes/fake_reflection_instance_with_abstract.py,sha256=SfL8FuFmr650RlzXTrP4tGMfsPVZLhOxVnBXu_g1POg,1471
|
219
219
|
tests/support/parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
220
|
-
tests/support/parsers/test_exception_parser.py,sha256=
|
220
|
+
tests/support/parsers/test_exception_parser.py,sha256=s-ZRbxyr9bs5uis2SM0IN-vCc-AJhWqRnEMIVgeEFXE,2363
|
221
221
|
tests/support/parsers/fakes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
222
222
|
tests/support/parsers/fakes/fake_custom_error.py,sha256=BD8tQPhmIYFYVcaeMpEQ6uK1d6pcU4EGbwRkVfCZp7c,802
|
223
223
|
tests/support/standard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
224
|
-
tests/support/standard/test_std.py,sha256=
|
225
|
-
orionis-0.
|
226
|
-
orionis-0.
|
227
|
-
orionis-0.
|
228
|
-
orionis-0.
|
229
|
-
orionis-0.
|
230
|
-
orionis-0.
|
224
|
+
tests/support/standard/test_std.py,sha256=bJ5LV_OKEEZa_Bk3PTk9Kapk6qECLzcKf0hfR_x2QqM,2042
|
225
|
+
orionis-0.218.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
226
|
+
orionis-0.218.0.dist-info/METADATA,sha256=SM6DhkD76pXjmZj6q4FSH1xUfHAsYoyl3ClHuNCt1nU,3003
|
227
|
+
orionis-0.218.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
228
|
+
orionis-0.218.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
|
229
|
+
orionis-0.218.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
230
|
+
orionis-0.218.0.dist-info/RECORD,,
|
@@ -10,7 +10,7 @@ class TestReflexionAbstract(TestCase):
|
|
10
10
|
using FakeAbstractClass as the test subject.
|
11
11
|
"""
|
12
12
|
|
13
|
-
def testReflectionAbstractExceptionValueError(self):
|
13
|
+
async def testReflectionAbstractExceptionValueError(self):
|
14
14
|
"""Class setup method.
|
15
15
|
|
16
16
|
Initializes the ReflexionAbstract instance with FakeAbstractClass
|
@@ -19,7 +19,7 @@ class TestReflexionAbstract(TestCase):
|
|
19
19
|
with self.assertRaises(ValueError):
|
20
20
|
Reflection.abstract(str)
|
21
21
|
|
22
|
-
def testReflectionAbstractGetClassName(self):
|
22
|
+
async def testReflectionAbstractGetClassName(self):
|
23
23
|
"""Test getClassName() method.
|
24
24
|
|
25
25
|
Verifies that:
|
@@ -30,7 +30,7 @@ class TestReflexionAbstract(TestCase):
|
|
30
30
|
self.assertEqual(class_name, "FakeAbstractClass")
|
31
31
|
self.assertIsInstance(class_name, str)
|
32
32
|
|
33
|
-
def testReflectionAbstractGetModuleName(self):
|
33
|
+
async def testReflectionAbstractGetModuleName(self):
|
34
34
|
"""Test getModuleName() method.
|
35
35
|
|
36
36
|
Verifies that:
|
@@ -41,7 +41,7 @@ class TestReflexionAbstract(TestCase):
|
|
41
41
|
self.assertTrue(module_name == 'tests.support.inspection.fakes.fake_reflection_abstract')
|
42
42
|
self.assertIsInstance(module_name, str)
|
43
43
|
|
44
|
-
def testReflectionAbstractGetAbstractMethods(self):
|
44
|
+
async def testReflectionAbstractGetAbstractMethods(self):
|
45
45
|
"""Test getAbstractMethods() method.
|
46
46
|
|
47
47
|
Verifies that:
|
@@ -54,7 +54,7 @@ class TestReflexionAbstract(TestCase):
|
|
54
54
|
self.assertEqual(methods, expected)
|
55
55
|
self.assertIsInstance(methods, set)
|
56
56
|
|
57
|
-
def testReflectionAbstractGetConcreteMethods(self):
|
57
|
+
async def testReflectionAbstractGetConcreteMethods(self):
|
58
58
|
"""Test getConcreteMethods() method.
|
59
59
|
|
60
60
|
Verifies that:
|
@@ -70,7 +70,7 @@ class TestReflexionAbstract(TestCase):
|
|
70
70
|
self.assertNotIn('_protected_method', methods)
|
71
71
|
self.assertNotIn('__private_method', methods)
|
72
72
|
|
73
|
-
def testReflectionAbstractGetStaticMethods(self):
|
73
|
+
async def testReflectionAbstractGetStaticMethods(self):
|
74
74
|
"""Test getStaticMethods() method.
|
75
75
|
|
76
76
|
Verifies that:
|
@@ -83,7 +83,7 @@ class TestReflexionAbstract(TestCase):
|
|
83
83
|
self.assertEqual(len(static_methods), 1)
|
84
84
|
self.assertNotIn('create_instance', static_methods)
|
85
85
|
|
86
|
-
def testReflectionAbstractGetClassMethods(self):
|
86
|
+
async def testReflectionAbstractGetClassMethods(self):
|
87
87
|
"""Test getClassMethods() method.
|
88
88
|
|
89
89
|
Verifies that:
|
@@ -96,7 +96,7 @@ class TestReflexionAbstract(TestCase):
|
|
96
96
|
self.assertEqual(len(class_methods), 1)
|
97
97
|
self.assertNotIn('static_helper', class_methods)
|
98
98
|
|
99
|
-
def testReflectionAbstractGetProperties(self):
|
99
|
+
async def testReflectionAbstractGetProperties(self):
|
100
100
|
"""Test getProperties() method.
|
101
101
|
|
102
102
|
Verifies that:
|
@@ -108,7 +108,7 @@ class TestReflexionAbstract(TestCase):
|
|
108
108
|
self.assertIn('computed_property', props)
|
109
109
|
self.assertEqual(len(props), 1)
|
110
110
|
|
111
|
-
def testReflectionAbstractGetMethodSignature(self):
|
111
|
+
async def testReflectionAbstractGetMethodSignature(self):
|
112
112
|
"""Test getMethodSignature() method.
|
113
113
|
|
114
114
|
Verifies that:
|
@@ -121,7 +121,7 @@ class TestReflexionAbstract(TestCase):
|
|
121
121
|
self.assertEqual(params, ['self', 'x', 'y'])
|
122
122
|
self.assertEqual(sig.return_annotation, int)
|
123
123
|
|
124
|
-
def testReflectionAbstractGetDocstring(self):
|
124
|
+
async def testReflectionAbstractGetDocstring(self):
|
125
125
|
"""Test getDocstring() method.
|
126
126
|
|
127
127
|
Verifies that:
|
@@ -132,7 +132,7 @@ class TestReflexionAbstract(TestCase):
|
|
132
132
|
self.assertTrue(doc.startswith("A fake abstract class"))
|
133
133
|
self.assertIsInstance(doc, str)
|
134
134
|
|
135
|
-
def testReflectionAbstractGetBaseAbstractClasses(self):
|
135
|
+
async def testReflectionAbstractGetBaseAbstractClasses(self):
|
136
136
|
"""Test getBaseAbstractClasses() method.
|
137
137
|
|
138
138
|
Verifies that:
|
@@ -142,7 +142,7 @@ class TestReflexionAbstract(TestCase):
|
|
142
142
|
bases = Reflection.abstract(FakeAbstractClass).getBaseAbstractClasses()
|
143
143
|
self.assertEqual(bases, (ABC,))
|
144
144
|
|
145
|
-
def testReflectionAbstractGetInterfaceMethods(self):
|
145
|
+
async def testReflectionAbstractGetInterfaceMethods(self):
|
146
146
|
"""Test getInterfaceMethods() method.
|
147
147
|
|
148
148
|
Verifies that:
|
@@ -156,7 +156,7 @@ class TestReflexionAbstract(TestCase):
|
|
156
156
|
sig = interface['abstract_method']
|
157
157
|
self.assertEqual(list(sig.parameters.keys()), ['self', 'x', 'y'])
|
158
158
|
|
159
|
-
def testReflectionAbstractIsSubclassOf(self):
|
159
|
+
async def testReflectionAbstractIsSubclassOf(self):
|
160
160
|
"""Test isSubclassOf() method.
|
161
161
|
|
162
162
|
Verifies that:
|
@@ -166,7 +166,7 @@ class TestReflexionAbstract(TestCase):
|
|
166
166
|
self.assertTrue(Reflection.abstract(FakeAbstractClass).isSubclassOf(ABC))
|
167
167
|
self.assertTrue(Reflection.abstract(FakeAbstractClass).isSubclassOf(object))
|
168
168
|
|
169
|
-
def testReflectionAbstractGetSourceCode(self):
|
169
|
+
async def testReflectionAbstractGetSourceCode(self):
|
170
170
|
"""Test getSourceCode() method.
|
171
171
|
|
172
172
|
Verifies that:
|
@@ -177,7 +177,7 @@ class TestReflexionAbstract(TestCase):
|
|
177
177
|
self.assertIsNotNone(source)
|
178
178
|
self.assertIn("class FakeAbstractClass(ABC):", source)
|
179
179
|
|
180
|
-
def testReflectionAbstractGetFileLocation(self):
|
180
|
+
async def testReflectionAbstractGetFileLocation(self):
|
181
181
|
"""Test getFileLocation() method.
|
182
182
|
|
183
183
|
Verifies that:
|
@@ -188,7 +188,7 @@ class TestReflexionAbstract(TestCase):
|
|
188
188
|
self.assertIsNotNone(location)
|
189
189
|
self.assertTrue('fake_reflection_abstract.py' in location)
|
190
190
|
|
191
|
-
def testReflectionAbstractGetAnnotations(self):
|
191
|
+
async def testReflectionAbstractGetAnnotations(self):
|
192
192
|
"""Test getAnnotations() method.
|
193
193
|
|
194
194
|
Verifies that:
|
@@ -199,7 +199,7 @@ class TestReflexionAbstract(TestCase):
|
|
199
199
|
self.assertIn('class_attr', annotations)
|
200
200
|
self.assertEqual(annotations['class_attr'], str)
|
201
201
|
|
202
|
-
def testReflectionAbstractGetDecorators(self):
|
202
|
+
async def testReflectionAbstractGetDecorators(self):
|
203
203
|
"""Test getDecorators() method.
|
204
204
|
|
205
205
|
Verifies that:
|
@@ -211,7 +211,7 @@ class TestReflexionAbstract(TestCase):
|
|
211
211
|
for decorator in decorators:
|
212
212
|
self.assertTrue(decorator in ['decorator_example', 'another_decorator'])
|
213
213
|
|
214
|
-
def testReflectionAbstractIsProtocol(self):
|
214
|
+
async def testReflectionAbstractIsProtocol(self):
|
215
215
|
"""Test isProtocol() method.
|
216
216
|
|
217
217
|
Verifies that:
|
@@ -219,7 +219,7 @@ class TestReflexionAbstract(TestCase):
|
|
219
219
|
"""
|
220
220
|
self.assertFalse(Reflection.abstract(FakeAbstractClass).isProtocol())
|
221
221
|
|
222
|
-
def testReflectionAbstractGetRequiredAttributes(self):
|
222
|
+
async def testReflectionAbstractGetRequiredAttributes(self):
|
223
223
|
"""Test getRequiredAttributes() method.
|
224
224
|
|
225
225
|
Verifies that:
|
@@ -227,11 +227,11 @@ class TestReflexionAbstract(TestCase):
|
|
227
227
|
"""
|
228
228
|
self.assertEqual(Reflection.abstract(FakeAbstractClass).getRequiredAttributes(), set())
|
229
229
|
|
230
|
-
def testReflectionAbstractGetAbstractProperties(self):
|
230
|
+
async def testReflectionAbstractGetAbstractProperties(self):
|
231
231
|
"""Test getRequiredMethods() method."""
|
232
232
|
self.assertEqual(Reflection.abstract(FakeAbstractClass).getAbstractProperties(), set())
|
233
233
|
|
234
|
-
def testReflectionAbstractGetPropertySignature(self):
|
234
|
+
async def testReflectionAbstractGetPropertySignature(self):
|
235
235
|
"""Test getPropertySignature() method."""
|
236
236
|
signature = Reflection.abstract(FakeAbstractClass).getPropertySignature('computed_property')
|
237
237
|
self.assertEqual(str(signature), '(self) -> float')
|
@@ -8,36 +8,36 @@ class TestReflectionConcrete(TestCase):
|
|
8
8
|
Unit tests for the Reflection class.
|
9
9
|
"""
|
10
10
|
|
11
|
-
def testReflectionConcreteExceptionValueError(self):
|
11
|
+
async def testReflectionConcreteExceptionValueError(self):
|
12
12
|
"""Ensure Reflection.instance raises ValueError for invalid types."""
|
13
13
|
with self.assertRaises(ValueError):
|
14
14
|
Reflection.concrete(str)
|
15
15
|
|
16
|
-
def testReflectionConcrete(self):
|
16
|
+
async def testReflectionConcrete(self):
|
17
17
|
"""Verify Reflection.instance returns an instance of ReflexionInstance."""
|
18
18
|
self.assertIsInstance(Reflection.concrete(FakeExample), ReflexionConcrete)
|
19
19
|
|
20
|
-
def testReflectionConcreteGetClassName(self):
|
20
|
+
async def testReflectionConcreteGetClassName(self):
|
21
21
|
"""Test getClassName method."""
|
22
22
|
reflection = Reflection.concrete(FakeExample)
|
23
23
|
self.assertEqual(reflection.getClassName(), "FakeExample")
|
24
24
|
|
25
|
-
def testReflectionConcreteGetClass(self):
|
25
|
+
async def testReflectionConcreteGetClass(self):
|
26
26
|
"""Test getClass method."""
|
27
27
|
reflection = Reflection.concrete(FakeExample)
|
28
28
|
self.assertEqual(reflection.getClass(), FakeExample)
|
29
29
|
|
30
|
-
def testReflectionConcreteGetModuleName(self):
|
30
|
+
async def testReflectionConcreteGetModuleName(self):
|
31
31
|
"""Test getModuleName method."""
|
32
32
|
reflection = Reflection.concrete(FakeExample)
|
33
33
|
self.assertEqual(reflection.getModuleName(), "tests.support.inspection.fakes.fake_reflection_concrete")
|
34
34
|
|
35
|
-
def testReflectionConcreteGetAttributes(self):
|
35
|
+
async def testReflectionConcreteGetAttributes(self):
|
36
36
|
"""Test getAttributes method."""
|
37
37
|
reflection = Reflection.concrete(FakeExample)
|
38
38
|
self.assertEqual(reflection.getAttributes(), {'class_attr': 42, 'another_attr': 'hello'})
|
39
39
|
|
40
|
-
def testReflectionConcreteGetMethods(self):
|
40
|
+
async def testReflectionConcreteGetMethods(self):
|
41
41
|
"""Test getMethods method."""
|
42
42
|
reflection = Reflection.concrete(FakeExample)
|
43
43
|
expected_methods = [
|
@@ -48,7 +48,7 @@ class TestReflectionConcrete(TestCase):
|
|
48
48
|
]
|
49
49
|
self.assertEqual(reflection.getMethods(), expected_methods)
|
50
50
|
|
51
|
-
def testReflectionConcreteGetStaticMethods(self):
|
51
|
+
async def testReflectionConcreteGetStaticMethods(self):
|
52
52
|
"""Test getStaticMethods method."""
|
53
53
|
reflection = Reflection.concrete(FakeExample)
|
54
54
|
expected_static_methods = [
|
@@ -56,7 +56,7 @@ class TestReflectionConcrete(TestCase):
|
|
56
56
|
]
|
57
57
|
self.assertEqual(reflection.getStaticMethods(), expected_static_methods)
|
58
58
|
|
59
|
-
def testReflectionConcreteGetPropertyNames(self):
|
59
|
+
async def testReflectionConcreteGetPropertyNames(self):
|
60
60
|
"""Test getPropertyNames method."""
|
61
61
|
reflection = Reflection.concrete(FakeExample)
|
62
62
|
expected_properties = [
|
@@ -65,43 +65,43 @@ class TestReflectionConcrete(TestCase):
|
|
65
65
|
]
|
66
66
|
self.assertEqual(reflection.getPropertyNames(), expected_properties)
|
67
67
|
|
68
|
-
def testReflectionConcreteGetMethodSignature(self):
|
68
|
+
async def testReflectionConcreteGetMethodSignature(self):
|
69
69
|
"""Test getMethodSignature method."""
|
70
70
|
reflection = Reflection.concrete(FakeExample)
|
71
71
|
self.assertEqual(str(reflection.getMethodSignature('method_one')), '(self, x: int) -> int')
|
72
72
|
self.assertEqual(str(reflection.getMethodSignature('method_two')), '(self, a: str, b: str = \'default\') -> str')
|
73
73
|
self.assertEqual(str(reflection.getMethodSignature('__init__')), '(self, value: int = 10) -> None')
|
74
74
|
|
75
|
-
def testReflectionConcreteGetPropertySignature(self):
|
75
|
+
async def testReflectionConcreteGetPropertySignature(self):
|
76
76
|
"""Test getPropertySignature method."""
|
77
77
|
reflection = Reflection.concrete(FakeExample)
|
78
78
|
self.assertEqual(str(reflection.getPropertySignature('prop')), '(self) -> int')
|
79
79
|
self.assertEqual(str(reflection.getPropertySignature('prop_with_getter')), '(self) -> str')
|
80
80
|
|
81
|
-
def testReflectionConcreteGetDocstring(self):
|
81
|
+
async def testReflectionConcreteGetDocstring(self):
|
82
82
|
"""Test getDocstring method."""
|
83
83
|
reflection = Reflection.concrete(FakeExample)
|
84
84
|
self.assertIn('This is a fake example class for testing reflection', reflection.getDocstring())
|
85
85
|
|
86
|
-
def testReflectionConcreteGetBaseClasses(self):
|
86
|
+
async def testReflectionConcreteGetBaseClasses(self):
|
87
87
|
"""Test getBaseClasses method."""
|
88
88
|
reflection = Reflection.concrete(FakeExample)
|
89
89
|
self.assertEqual(reflection.getBaseClasses(), (BaseExample,))
|
90
90
|
|
91
|
-
def testReflectionConcreteIsSubclassOf(self):
|
91
|
+
async def testReflectionConcreteIsSubclassOf(self):
|
92
92
|
"""Test isSubclassOf method."""
|
93
93
|
reflection = Reflection.concrete(FakeExample)
|
94
94
|
self.assertTrue(reflection.isSubclassOf(BaseExample))
|
95
95
|
self.assertFalse(reflection.isSubclassOf(str))
|
96
96
|
|
97
|
-
def testReflectionConcreteGetSourceCode(self):
|
97
|
+
async def testReflectionConcreteGetSourceCode(self):
|
98
98
|
"""Test getSourceCode method."""
|
99
99
|
reflection = Reflection.concrete(FakeExample)
|
100
100
|
source_code = reflection.getSourceCode()
|
101
101
|
self.assertIn('class FakeExample(BaseExample):', source_code)
|
102
102
|
self.assertIn('def method_one(self, x: int) -> int:', source_code)
|
103
103
|
|
104
|
-
def testReflectionConcreteGetFileLocation(self):
|
104
|
+
async def testReflectionConcreteGetFileLocation(self):
|
105
105
|
"""Test getFileLocation method."""
|
106
106
|
reflection = Reflection.concrete(FakeExample)
|
107
107
|
file_location = reflection.getFileLocation()
|
@@ -111,25 +111,25 @@ class TestReflectionConcrete(TestCase):
|
|
111
111
|
self.assertIn('fakes', file_location)
|
112
112
|
self.assertIn('fake_reflection_concrete.py', file_location)
|
113
113
|
|
114
|
-
def testReflectionConcreteGetAnnotations(self):
|
114
|
+
async def testReflectionConcreteGetAnnotations(self):
|
115
115
|
"""Test getAnnotations method."""
|
116
116
|
reflection = Reflection.concrete(FakeExample)
|
117
117
|
self.assertEqual(reflection.getAnnotations(), {'class_attr': int})
|
118
118
|
|
119
|
-
def testReflectionConcreteHasAttribute(self):
|
119
|
+
async def testReflectionConcreteHasAttribute(self):
|
120
120
|
"""Test hasAttribute method."""
|
121
121
|
reflection = Reflection.concrete(FakeExample)
|
122
122
|
self.assertTrue(reflection.hasAttribute('class_attr'))
|
123
123
|
self.assertFalse(reflection.hasAttribute('non_existent_attr'))
|
124
124
|
|
125
|
-
def testReflectionConcreteGetAttribute(self):
|
125
|
+
async def testReflectionConcreteGetAttribute(self):
|
126
126
|
"""Test getAttribute method."""
|
127
127
|
reflection = Reflection.concrete(FakeExample)
|
128
128
|
self.assertEqual(reflection.getAttribute('class_attr'), 42)
|
129
129
|
with self.assertRaises(AttributeError):
|
130
130
|
reflection.getAttribute('non_existent_attr')
|
131
131
|
|
132
|
-
def testReflectionConcreteGetCallableMembers(self):
|
132
|
+
async def testReflectionConcreteGetCallableMembers(self):
|
133
133
|
"""Test getCallableMembers method."""
|
134
134
|
reflection = Reflection.concrete(FakeExample)
|
135
135
|
callable_members = reflection.getCallableMembers()
|
@@ -4,7 +4,7 @@ from tests.support.inspection.fakes.fake_reflection_concrete_with_abstract impor
|
|
4
4
|
|
5
5
|
class TestReflexionConcreteWithAbstract(TestCase):
|
6
6
|
|
7
|
-
def testReflexionInstanceWithAbstractGetImplementationAnalysis(self):
|
7
|
+
async def testReflexionInstanceWithAbstractGetImplementationAnalysis(self):
|
8
8
|
"""Test reflexion con AbstractService y PartiallyImplementedService."""
|
9
9
|
inspector = ReflexionConcreteWithAbstract(PartiallyImplementedService, AbstractService)
|
10
10
|
|
@@ -42,7 +42,7 @@ class TestReflexionConcreteWithAbstract(TestCase):
|
|
42
42
|
self.assertFalse(analysis['status']['signature_match'])
|
43
43
|
self.assertEqual(analysis['status']['type'], 'property')
|
44
44
|
|
45
|
-
def testReflexionConcreteWithAbstractGetNonInheritedImplementation(self):
|
45
|
+
async def testReflexionConcreteWithAbstractGetNonInheritedImplementation(self):
|
46
46
|
"""Test reflexion con AbstractService y PartiallyImplementedService."""
|
47
47
|
inspector = ReflexionConcreteWithAbstract(PartiallyImplementedService, AbstractService)
|
48
48
|
|
@@ -53,7 +53,7 @@ class TestReflexionConcreteWithAbstract(TestCase):
|
|
53
53
|
self.assertListEqual(analysis['properties'], [])
|
54
54
|
self.assertIn('__annotations__', analysis['attributes'])
|
55
55
|
|
56
|
-
def testReflexionConcreteWithAbstractValidateImplementation(self):
|
56
|
+
async def testReflexionConcreteWithAbstractValidateImplementation(self):
|
57
57
|
"""Test reflexion con AbstractService y PartiallyImplementedService."""
|
58
58
|
inspector = ReflexionConcreteWithAbstract(PartiallyImplementedService, AbstractService)
|
59
59
|
|
@@ -64,7 +64,7 @@ class TestReflexionConcreteWithAbstract(TestCase):
|
|
64
64
|
self.assertFalse(is_valid)
|
65
65
|
self.assertIn('reset', issues['missing'])
|
66
66
|
|
67
|
-
def testReflexionConcreteWithAbstractGetHierarchyAnalysis(self):
|
67
|
+
async def testReflexionConcreteWithAbstractGetHierarchyAnalysis(self):
|
68
68
|
"""Test reflexion con AbstractService y PartiallyImplementedService."""
|
69
69
|
inspector = ReflexionConcreteWithAbstract(PartiallyImplementedService, AbstractService)
|
70
70
|
|
@@ -76,7 +76,7 @@ class TestReflexionConcreteWithAbstract(TestCase):
|
|
76
76
|
self.assertIn('AbstractService', analysis['abstract_hierarchy'])
|
77
77
|
self.assertIn('PartiallyImplementedService', analysis['concrete_hierarchy'])
|
78
78
|
|
79
|
-
def testReflexionConcreteWithAbstractGetImplementationCoverage(self):
|
79
|
+
async def testReflexionConcreteWithAbstractGetImplementationCoverage(self):
|
80
80
|
"""Test reflexion con AbstractService y PartiallyImplementedService."""
|
81
81
|
inspector = ReflexionConcreteWithAbstract(PartiallyImplementedService, AbstractService)
|
82
82
|
|
@@ -2,37 +2,38 @@ from orionis.luminate.support.inspection.reflection import Reflection
|
|
2
2
|
from orionis.luminate.support.inspection.reflexion_instance import ReflexionInstance
|
3
3
|
from orionis.luminate.test.test_case import TestCase
|
4
4
|
from tests.support.inspection.fakes.fake_reflection_instance import BaseFakeClass, FakeClass
|
5
|
+
import asyncio
|
5
6
|
|
6
7
|
class TestReflectionInstance(TestCase):
|
7
8
|
"""
|
8
9
|
Unit tests for the Reflection class.
|
9
10
|
"""
|
10
11
|
|
11
|
-
def testReflectionInstanceExceptionValueError(self):
|
12
|
+
async def testReflectionInstanceExceptionValueError(self):
|
12
13
|
"""Ensure Reflection.instance raises ValueError for invalid types."""
|
13
14
|
with self.assertRaises(ValueError):
|
14
15
|
Reflection.instance(str)
|
15
16
|
|
16
|
-
def testReflectionInstance(self):
|
17
|
+
async def testReflectionInstance(self):
|
17
18
|
"""Verify Reflection.instance returns an instance of ReflexionInstance."""
|
18
19
|
self.assertIsInstance(Reflection.instance(FakeClass()), ReflexionInstance)
|
19
20
|
|
20
|
-
def testReflectionInstanceGetClassName(self):
|
21
|
+
async def testReflectionInstanceGetClassName(self):
|
21
22
|
"""Check that getClassName returns the correct class name."""
|
22
23
|
reflex = Reflection.instance(FakeClass())
|
23
24
|
self.assertEqual(reflex.getClassName(), "FakeClass")
|
24
25
|
|
25
|
-
def testReflectionInstanceGetClass(self):
|
26
|
+
async def testReflectionInstanceGetClass(self):
|
26
27
|
"""Ensure getClass returns the correct class."""
|
27
28
|
reflex = Reflection.instance(FakeClass())
|
28
29
|
self.assertEqual(reflex.getClass(), FakeClass)
|
29
30
|
|
30
|
-
def testReflectionInstanceGetModuleName(self):
|
31
|
+
async def testReflectionInstanceGetModuleName(self):
|
31
32
|
"""Verify getModuleName returns the correct module name."""
|
32
33
|
reflex = Reflection.instance(FakeClass())
|
33
34
|
self.assertEqual(reflex.getModuleName(), "tests.support.inspection.fakes.fake_reflection_instance")
|
34
35
|
|
35
|
-
def testReflectionInstanceGetAttributes(self):
|
36
|
+
async def testReflectionInstanceGetAttributes(self):
|
36
37
|
"""Check that getAttributes returns all attributes of the class."""
|
37
38
|
reflex = Reflection.instance(FakeClass())
|
38
39
|
attributes = reflex.getAttributes()
|
@@ -40,85 +41,85 @@ class TestReflectionInstance(TestCase):
|
|
40
41
|
self.assertTrue("_private_attr" in attributes)
|
41
42
|
self.assertTrue("dynamic_attr" in attributes)
|
42
43
|
|
43
|
-
def testReflectionInstanceGetMethods(self):
|
44
|
+
async def testReflectionInstanceGetMethods(self):
|
44
45
|
"""Ensure getMethods returns all methods of the class."""
|
45
46
|
reflex = Reflection.instance(FakeClass())
|
46
47
|
methods = reflex.getMethods()
|
47
48
|
self.assertTrue("instance_method" in methods)
|
48
49
|
self.assertTrue("class_method" in methods)
|
49
50
|
|
50
|
-
def testReflectionInstanceGetStaticMethods(self):
|
51
|
+
async def testReflectionInstanceGetStaticMethods(self):
|
51
52
|
"""Verify getStaticMethods returns all static methods of the class."""
|
52
53
|
reflex = Reflection.instance(FakeClass())
|
53
54
|
methods = reflex.getStaticMethods()
|
54
55
|
self.assertTrue("static_method" in methods)
|
55
56
|
|
56
|
-
def testReflectionInstanceGetPropertyNames(self):
|
57
|
+
async def testReflectionInstanceGetPropertyNames(self):
|
57
58
|
"""Check that getPropertyNames returns all property names."""
|
58
59
|
reflex = Reflection.instance(FakeClass())
|
59
60
|
properties = reflex.getPropertyNames()
|
60
61
|
self.assertTrue("computed_property" in properties)
|
61
62
|
|
62
|
-
def testReflectionInstanceCallMethod(self):
|
63
|
+
async def testReflectionInstanceCallMethod(self):
|
63
64
|
"""Ensure callMethod correctly invokes a method with arguments."""
|
64
65
|
reflex = Reflection.instance(FakeClass())
|
65
66
|
result = reflex.callMethod("instance_method", 1, 2)
|
66
67
|
self.assertEqual(result, 3)
|
67
68
|
|
68
|
-
def testReflectionInstanceGetMethodSignature(self):
|
69
|
+
async def testReflectionInstanceGetMethodSignature(self):
|
69
70
|
"""Verify getMethodSignature returns the correct method signature."""
|
70
71
|
reflex = Reflection.instance(FakeClass())
|
71
72
|
signature = reflex.getMethodSignature("instance_method")
|
72
73
|
self.assertEqual(str(signature), "(x: int, y: int) -> int")
|
73
74
|
|
74
|
-
def testReflectionInstanceGetDocstring(self):
|
75
|
+
async def testReflectionInstanceGetDocstring(self):
|
75
76
|
"""Check that getDocstring returns the correct class docstring."""
|
76
77
|
reflex = Reflection.instance(FakeClass())
|
77
78
|
docstring = reflex.getDocstring()
|
78
79
|
self.assertIn("This is a test class for ReflexionInstance", docstring)
|
79
80
|
|
80
|
-
def testReflectionInstanceGetBaseClasses(self):
|
81
|
+
async def testReflectionInstanceGetBaseClasses(self):
|
81
82
|
"""Ensure getBaseClasses returns the correct base classes."""
|
82
83
|
reflex = Reflection.instance(FakeClass())
|
83
84
|
base_classes = reflex.getBaseClasses()
|
84
85
|
self.assertIn(BaseFakeClass, base_classes)
|
85
86
|
|
86
|
-
def testReflectionInstanceIsInstanceOf(self):
|
87
|
+
async def testReflectionInstanceIsInstanceOf(self):
|
87
88
|
"""Verify isInstanceOf checks inheritance correctly."""
|
88
89
|
reflex = Reflection.instance(FakeClass())
|
89
90
|
self.assertTrue(reflex.isInstanceOf(BaseFakeClass))
|
90
91
|
|
91
|
-
def testReflectionInstanceGetSourceCode(self):
|
92
|
+
async def testReflectionInstanceGetSourceCode(self):
|
92
93
|
"""Check that getSourceCode returns the class source code."""
|
93
94
|
reflex = Reflection.instance(FakeClass())
|
94
95
|
source_code = reflex.getSourceCode()
|
95
96
|
self.assertIn("class FakeClass(BaseFakeClass):", source_code)
|
96
97
|
|
97
|
-
def testReflectionInstanceGetFileLocation(self):
|
98
|
+
async def testReflectionInstanceGetFileLocation(self):
|
98
99
|
"""Ensure getFileLocation returns the correct file path."""
|
99
100
|
reflex = Reflection.instance(FakeClass())
|
100
101
|
file_location = reflex.getFileLocation()
|
101
102
|
self.assertIn("fake_reflection_instance.py", file_location)
|
102
103
|
|
103
|
-
def testReflectionInstanceGetAnnotations(self):
|
104
|
+
async def testReflectionInstanceGetAnnotations(self):
|
104
105
|
"""Verify getAnnotations returns the correct class annotations."""
|
105
106
|
reflex = Reflection.instance(FakeClass())
|
106
107
|
annotations = reflex.getAnnotations()
|
107
108
|
self.assertEqual("{'class_attr': <class 'str'>}", str(annotations))
|
108
109
|
|
109
|
-
def testReflectionInstanceHasAttribute(self):
|
110
|
+
async def testReflectionInstanceHasAttribute(self):
|
110
111
|
"""Check that hasAttribute correctly identifies attributes."""
|
111
112
|
reflex = Reflection.instance(FakeClass())
|
112
113
|
self.assertTrue(reflex.hasAttribute("public_attr"))
|
113
114
|
self.assertFalse(reflex.hasAttribute("non_existent_attr"))
|
114
115
|
|
115
|
-
def testReflectionInstanceGetAttribute(self):
|
116
|
+
async def testReflectionInstanceGetAttribute(self):
|
116
117
|
"""Ensure getAttribute retrieves the correct attribute value."""
|
117
118
|
reflex = Reflection.instance(FakeClass())
|
118
119
|
attr_value = reflex.getAttribute("public_attr")
|
119
120
|
self.assertEqual(attr_value, 42)
|
120
121
|
|
121
|
-
def testReflectionInstanceGetCallableMembers(self):
|
122
|
+
async def testReflectionInstanceGetCallableMembers(self):
|
122
123
|
"""Verify getCallableMembers returns all callable members."""
|
123
124
|
reflex = Reflection.instance(FakeClass())
|
124
125
|
callable_members = reflex.getCallableMembers()
|
@@ -126,9 +127,11 @@ class TestReflectionInstance(TestCase):
|
|
126
127
|
self.assertIn("class_method", callable_members)
|
127
128
|
self.assertIn("static_method", callable_members)
|
128
129
|
|
129
|
-
def testReflectionInstanceSetAttribute(self):
|
130
|
+
async def testReflectionInstanceSetAttribute(self):
|
130
131
|
"""Check that setAttribute correctly sets a new attribute."""
|
131
|
-
def myMacro(cls: FakeClass, num):
|
132
|
+
async def myMacro(cls: FakeClass, num):
|
133
|
+
"""Simulate an async function with an async sleep."""
|
134
|
+
await asyncio.sleep(0.1)
|
132
135
|
return cls.instance_method(10, 12) + num
|
133
136
|
|
134
137
|
reflex = Reflection.instance(FakeClass())
|
@@ -136,7 +139,7 @@ class TestReflectionInstance(TestCase):
|
|
136
139
|
|
137
140
|
self.assertTrue(reflex.hasAttribute("myMacro"))
|
138
141
|
|
139
|
-
result = reflex.callMethod("myMacro", reflex._instance, 3)
|
142
|
+
result = await reflex.callMethod("myMacro", reflex._instance, 3)
|
140
143
|
self.assertEqual(result, 25)
|
141
144
|
|
142
145
|
def testReflectionInstanceGetPropertySignature(self):
|
@@ -4,7 +4,7 @@ from tests.support.inspection.fakes.fake_reflection_instance_with_abstract impor
|
|
4
4
|
|
5
5
|
class TestReflexionInstanceWithAbstract(TestCase):
|
6
6
|
|
7
|
-
def testReflexionInstanceWithAbstractGetImplementationAnalysis(self):
|
7
|
+
async def testReflexionInstanceWithAbstractGetImplementationAnalysis(self):
|
8
8
|
"""Test reflexion con IDataProcessor y FakeDataProcessor."""
|
9
9
|
processor = FakeDataProcessor()
|
10
10
|
inspector = ReflexionInstanceWithAbstract(processor, IDataProcessor)
|
@@ -31,7 +31,7 @@ class TestReflexionInstanceWithAbstract(TestCase):
|
|
31
31
|
self.assertTrue(analysis['config']['signature_match'])
|
32
32
|
self.assertEqual(analysis['config']['type'], 'property')
|
33
33
|
|
34
|
-
def testReflexionInstanceWithAbstractGetNonInheritedImplementation(self):
|
34
|
+
async def testReflexionInstanceWithAbstractGetNonInheritedImplementation(self):
|
35
35
|
"""Test reflexion con IDataProcessor y FakeDataProcessor."""
|
36
36
|
processor = FakeDataProcessor()
|
37
37
|
inspector = ReflexionInstanceWithAbstract(processor, IDataProcessor)
|
@@ -42,7 +42,7 @@ class TestReflexionInstanceWithAbstract(TestCase):
|
|
42
42
|
# Verifying implemented methods
|
43
43
|
self.assertIn('extra_method', analysis['methods'])
|
44
44
|
|
45
|
-
def testReflexionInstanceWithAbstractValidateImplementation(self):
|
45
|
+
async def testReflexionInstanceWithAbstractValidateImplementation(self):
|
46
46
|
"""Test reflexion con IDataProcessor y FakeDataProcessor."""
|
47
47
|
processor = FakeDataProcessor()
|
48
48
|
inspector = ReflexionInstanceWithAbstract(processor, IDataProcessor)
|
@@ -54,7 +54,7 @@ class TestReflexionInstanceWithAbstract(TestCase):
|
|
54
54
|
self.assertFalse(is_valid)
|
55
55
|
self.assertIn('process', issues['signature_mismatch'])
|
56
56
|
|
57
|
-
def testReflexionInstanceWithAbstractGetHierarchyAnalysis(self):
|
57
|
+
async def testReflexionInstanceWithAbstractGetHierarchyAnalysis(self):
|
58
58
|
"""Test reflexion con IDataProcessor y FakeDataProcessor."""
|
59
59
|
processor = FakeDataProcessor()
|
60
60
|
inspector = ReflexionInstanceWithAbstract(processor, IDataProcessor)
|
@@ -67,7 +67,7 @@ class TestReflexionInstanceWithAbstract(TestCase):
|
|
67
67
|
self.assertIn('IDataProcessor', analysis['abstract_hierarchy'])
|
68
68
|
self.assertIn('FakeDataProcessor', analysis['concrete_hierarchy'])
|
69
69
|
|
70
|
-
def testReflexionInstanceWithAbstractGetImplementationCoverage(self):
|
70
|
+
async def testReflexionInstanceWithAbstractGetImplementationCoverage(self):
|
71
71
|
"""Test reflexion con IDataProcessor y FakeDataProcessor."""
|
72
72
|
processor = FakeDataProcessor()
|
73
73
|
inspector = ReflexionInstanceWithAbstract(processor, IDataProcessor)
|
@@ -4,7 +4,7 @@ from tests.support.parsers.fakes.fake_custom_error import CustomError
|
|
4
4
|
|
5
5
|
class TestsExceptionParser(TestCase):
|
6
6
|
|
7
|
-
def testBasicExceptionStructure(self):
|
7
|
+
async def testBasicExceptionStructure(self):
|
8
8
|
"""
|
9
9
|
Ensure that the ExceptionParser correctly structures a basic exception.
|
10
10
|
"""
|
@@ -27,7 +27,7 @@ class TestsExceptionParser(TestCase):
|
|
27
27
|
self.assertIsInstance(result["stack_trace"], list)
|
28
28
|
self.assertGreater(len(result["stack_trace"]), 0)
|
29
29
|
|
30
|
-
def testRawExceptionProperty(self):
|
30
|
+
async def testRawExceptionProperty(self):
|
31
31
|
"""
|
32
32
|
Ensure that the raw_exception property returns the original exception.
|
33
33
|
"""
|
@@ -37,7 +37,7 @@ class TestsExceptionParser(TestCase):
|
|
37
37
|
parser = ExceptionParser(e)
|
38
38
|
self.assertIs(parser.raw_exception, e)
|
39
39
|
|
40
|
-
def testExceptionWithCode(self):
|
40
|
+
async def testExceptionWithCode(self):
|
41
41
|
try:
|
42
42
|
raise CustomError("Custom message", code=404)
|
43
43
|
except Exception as e:
|
@@ -45,7 +45,7 @@ class TestsExceptionParser(TestCase):
|
|
45
45
|
self.assertEqual(result["error_code"], 404)
|
46
46
|
self.assertEqual(result["error_type"], "CustomError")
|
47
47
|
|
48
|
-
def testNestedExceptionCause(self):
|
48
|
+
async def testNestedExceptionCause(self):
|
49
49
|
"""
|
50
50
|
Ensure that the ExceptionParser correctly handles nested exceptions.
|
51
51
|
"""
|
@@ -3,54 +3,58 @@ from orionis.luminate.test.test_case import TestCase
|
|
3
3
|
|
4
4
|
class TestStdClass(TestCase):
|
5
5
|
|
6
|
-
def testInitializationAndAccess(self):
|
7
|
-
obj = StdClass(
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
async def testInitializationAndAccess(self):
|
7
|
+
obj = StdClass(
|
8
|
+
first_name='Raul',
|
9
|
+
last_name='Uñate',
|
10
|
+
age=31
|
11
|
+
)
|
12
|
+
self.assertEqual(obj.first_name, 'Raul')
|
13
|
+
self.assertEqual(obj.age, 31)
|
14
|
+
|
15
|
+
async def testToDictReturnsCorrectData(self):
|
12
16
|
obj = StdClass(a=1, b=2)
|
13
17
|
expected = {'a': 1, 'b': 2}
|
14
18
|
self.assertEqual(obj.toDict(), expected)
|
15
19
|
|
16
|
-
def testUpdateAttributes(self):
|
20
|
+
async def testUpdateAttributes(self):
|
17
21
|
obj = StdClass()
|
18
22
|
obj.update(foo='bar', number=42)
|
19
23
|
self.assertEqual(obj.foo, 'bar')
|
20
24
|
self.assertEqual(obj.number, 42)
|
21
25
|
|
22
|
-
def testUpdateReservedAttributeRaisesError(self):
|
26
|
+
async def testUpdateReservedAttributeRaisesError(self):
|
23
27
|
obj = StdClass()
|
24
28
|
with self.assertRaises(ValueError):
|
25
29
|
obj.update(__init__='bad')
|
26
30
|
|
27
|
-
def testUpdateConflictingAttributeRaisesError(self):
|
31
|
+
async def testUpdateConflictingAttributeRaisesError(self):
|
28
32
|
obj = StdClass()
|
29
33
|
with self.assertRaises(ValueError):
|
30
34
|
obj.update(toDict='oops')
|
31
35
|
|
32
|
-
def testRemoveExistingAttributes(self):
|
36
|
+
async def testRemoveExistingAttributes(self):
|
33
37
|
obj = StdClass(x=1, y=2)
|
34
38
|
obj.remove('x')
|
35
39
|
self.assertFalse(hasattr(obj, 'x'))
|
36
40
|
self.assertTrue(hasattr(obj, 'y'))
|
37
41
|
|
38
|
-
def testRemoveNonExistingAttributeRaisesError(self):
|
42
|
+
async def testRemoveNonExistingAttributeRaisesError(self):
|
39
43
|
obj = StdClass()
|
40
44
|
with self.assertRaises(AttributeError):
|
41
45
|
obj.remove('not_there')
|
42
46
|
|
43
|
-
def testFromDictCreatesEquivalentInstance(self):
|
47
|
+
async def testFromDictCreatesEquivalentInstance(self):
|
44
48
|
data = {'a': 10, 'b': 20}
|
45
49
|
obj = StdClass.from_dict(data)
|
46
50
|
self.assertEqual(obj.toDict(), data)
|
47
51
|
|
48
|
-
def testReprAndStr(self):
|
52
|
+
async def testReprAndStr(self):
|
49
53
|
obj = StdClass(x=5)
|
50
54
|
self.assertIn("StdClass", repr(obj))
|
51
55
|
self.assertIn("'x': 5", str(obj))
|
52
56
|
|
53
|
-
def testEquality(self):
|
57
|
+
async def testEquality(self):
|
54
58
|
a = StdClass(x=1, y=2)
|
55
59
|
b = StdClass(x=1, y=2)
|
56
60
|
c = StdClass(x=3)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|