orionis 0.217.0__py3-none-any.whl → 0.219.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/application.py +1 -1
- orionis/luminate/container/resolve.py +1 -1
- orionis/luminate/contracts/facades/facade.py +1 -1
- orionis/luminate/support/adapters/__init__.py +0 -0
- orionis/luminate/support/async_io/__init__.py +0 -0
- orionis/luminate/support/async_io/async_coroutine.py +48 -0
- orionis/luminate/support/async_io/contracts/async_coroutine.py +31 -0
- orionis/luminate/support/standard/std.py +0 -9
- orionis/luminate/test/contracts/__init__.py +0 -0
- orionis/luminate/test/contracts/test_std_out.py +17 -0
- orionis/luminate/test/contracts/test_suite.py +37 -0
- orionis/luminate/test/contracts/test_unit.py +82 -0
- orionis/luminate/test/test_case.py +58 -1
- orionis/luminate/test/test_std_out.py +3 -2
- orionis/luminate/test/test_suite.py +2 -1
- orionis/luminate/test/test_unit.py +2 -1
- {orionis-0.217.0.dist-info → orionis-0.219.0.dist-info}/METADATA +1 -1
- {orionis-0.217.0.dist-info → orionis-0.219.0.dist-info}/RECORD +37 -24
- tests/support/adapters/__init__.py +0 -0
- tests/support/adapters/fakes/__init__.py +0 -0
- tests/support/adapters/fakes/fake_dict.py +15 -0
- tests/support/adapters/test_doct_dict.py +21 -0
- tests/support/async_io/__init__.py +0 -0
- tests/support/async_io/test_async_coroutine.py +35 -0
- 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 +10 -10
- orionis/luminate/support/asyn_run.py +0 -41
- /orionis/luminate/support/{dot_dict.py → adapters/dot_dict.py} +0 -0
- {orionis-0.217.0.dist-info → orionis-0.219.0.dist-info}/LICENCE +0 -0
- {orionis-0.217.0.dist-info → orionis-0.219.0.dist-info}/WHEEL +0 -0
- {orionis-0.217.0.dist-info → orionis-0.219.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.217.0.dist-info → orionis-0.219.0.dist-info}/top_level.txt +0 -0
@@ -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
|
"""
|