orionis 0.239.0__py3-none-any.whl → 0.240.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 +1 -1
- orionis/luminate/support/introspection/__init__.py +1 -2
- orionis/luminate/support/introspection/abstracts/__init__.py +0 -0
- orionis/luminate/support/introspection/{reflect_abstract.py → abstracts/reflect_abstract.py} +66 -2
- orionis/luminate/support/introspection/contracts/reflexion_abstract.py +0 -1
- orionis/luminate/support/introspection/instances/contracts/__init__.py +0 -0
- orionis/luminate/support/introspection/instances/contracts/reflection_instance.py +644 -0
- orionis/luminate/support/introspection/instances/reflection_instance.py +4 -1
- orionis/luminate/support/introspection/reflection.py +1 -1
- orionis/luminate/support/introspection/reflexion_concrete_with_abstract.py +1 -1
- orionis/luminate/support/introspection/reflexion_instance_with_abstract.py +1 -1
- {orionis-0.239.0.dist-info → orionis-0.240.0.dist-info}/METADATA +1 -1
- {orionis-0.239.0.dist-info → orionis-0.240.0.dist-info}/RECORD +20 -17
- tests/support/inspection/fakes/{fake_reflection_abstract.py → fake_reflect_abstract.py} +2 -0
- tests/support/inspection/test_reflect_abstract.py +273 -0
- tests/support/inspection/test_reflect_instance.py +1 -0
- tests/support/inspection/test_reflection_abstract.py +0 -255
- {orionis-0.239.0.dist-info → orionis-0.240.0.dist-info}/LICENCE +0 -0
- {orionis-0.239.0.dist-info → orionis-0.240.0.dist-info}/WHEEL +0 -0
- {orionis-0.239.0.dist-info → orionis-0.240.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.239.0.dist-info → orionis-0.240.0.dist-info}/top_level.txt +0 -0
@@ -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=G5qsJtJrP_vwcG9n5yrR18nTjlpsC-Ia85Q1mlqjVKY,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
|
@@ -166,19 +166,20 @@ orionis/luminate/support/environment/functions.py,sha256=L6gL4z3c89ZU17IWvOXyQ2_
|
|
166
166
|
orionis/luminate/support/environment/helper.py,sha256=G1670w1xkI1pj-rW_inv6D3XmU4oliwnWnrJO5CBm2E,818
|
167
167
|
orionis/luminate/support/environment/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
168
168
|
orionis/luminate/support/environment/contracts/env.py,sha256=buJfzebBOUuq2CnhQCWlnJuzJAEo06-S0_SPR4N_mOY,1647
|
169
|
-
orionis/luminate/support/introspection/__init__.py,sha256=
|
169
|
+
orionis/luminate/support/introspection/__init__.py,sha256=Mf9u1ZQNvC4-Y_Ycl-qIBQr3SoJ315ZBtOb4-JoykxI,108
|
170
170
|
orionis/luminate/support/introspection/container_integrity.py,sha256=6d9FsGk-Rm1AXgqBS3Nww49dR7n1ptXTTNyGUuBHgNY,10111
|
171
|
-
orionis/luminate/support/introspection/reflect_abstract.py,sha256=vcPy5r33WeyTzFEXGMmGeI7C23_S4nGS_VXBBODAfng,10851
|
172
171
|
orionis/luminate/support/introspection/reflect_decorators.py,sha256=fnxnkEcRSU8TxDGdjCNlvXMNHEKzW7AwO_aPOVCbs9w,11548
|
173
|
-
orionis/luminate/support/introspection/reflection.py,sha256=
|
172
|
+
orionis/luminate/support/introspection/reflection.py,sha256=BVltcTm_0MbD_q2m2f15hSfmU3s-E4tynEX0R7TtXE0,7843
|
174
173
|
orionis/luminate/support/introspection/reflexion_concrete.py,sha256=1ISuy2L6Oser-EhmpuGALmbauh7Z-X8Rx1YYgt5CabQ,7543
|
175
|
-
orionis/luminate/support/introspection/reflexion_concrete_with_abstract.py,sha256=
|
176
|
-
orionis/luminate/support/introspection/reflexion_instance_with_abstract.py,sha256=
|
174
|
+
orionis/luminate/support/introspection/reflexion_concrete_with_abstract.py,sha256=kChzEBIoHW3U96UaonGxlDjdgiC-FqBdmqgHmS11FAI,7494
|
175
|
+
orionis/luminate/support/introspection/reflexion_instance_with_abstract.py,sha256=E38t6BHgzSkgFTlg64fgaV-U3vtdqbj3nkgrA4S4G4w,9434
|
177
176
|
orionis/luminate/support/introspection/reflexion_module.py,sha256=OgBXpqNJHkmq-gX4rqFStv-WVNe9R38RsgUgfHpak8k,405
|
178
177
|
orionis/luminate/support/introspection/reflexion_module_with_classname.py,sha256=YZHZI0XUZkSWnq9wrGxrIXtI64nY9yVSZoMe7PZXq8Y,620
|
178
|
+
orionis/luminate/support/introspection/abstracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
179
|
+
orionis/luminate/support/introspection/abstracts/reflect_abstract.py,sha256=MiLkkX0WIIOoP8vU2hM-4FYS2oNVuqwtGn6Ys0Y9bgE,12761
|
179
180
|
orionis/luminate/support/introspection/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
180
181
|
orionis/luminate/support/introspection/contracts/reflection.py,sha256=zF9OLiEdgWJtJWvfrmWCQhbDjgYmm-QvAkFv9OLb3rE,4959
|
181
|
-
orionis/luminate/support/introspection/contracts/reflexion_abstract.py,sha256=
|
182
|
+
orionis/luminate/support/introspection/contracts/reflexion_abstract.py,sha256=3m0DTIFpbRyYMcqTPt_qtPdOEpM1Zpx0FbnTAruXPhU,6384
|
182
183
|
orionis/luminate/support/introspection/dependencies/__init__.py,sha256=WWSAZWJzc4fhCWVycKMgalFPXzLyUiVc01qhAIm5XBc,149
|
183
184
|
orionis/luminate/support/introspection/dependencies/reflect_dependencies.py,sha256=Udg4eUDehJiJNaiZOwGvpomNA2OvEQRwbKQk6OPb1sw,7027
|
184
185
|
orionis/luminate/support/introspection/dependencies/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -190,7 +191,9 @@ orionis/luminate/support/introspection/dependencies/entities/resolved_dependenci
|
|
190
191
|
orionis/luminate/support/introspection/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
191
192
|
orionis/luminate/support/introspection/helpers/functions.py,sha256=JC2_t732LqcJn3zoRZwFAqcm6kT6HvsJmupysjH3aiY,8537
|
192
193
|
orionis/luminate/support/introspection/instances/__init__.py,sha256=R6dZ6yPk-4m2IaW74ceM4-Sba52aeAryfmIK4pAVWpc,144
|
193
|
-
orionis/luminate/support/introspection/instances/reflection_instance.py,sha256=
|
194
|
+
orionis/luminate/support/introspection/instances/reflection_instance.py,sha256=Kr9KXI6-XS5do8zldVi039S3iRb9eYHXUiYtLeexXQk,24482
|
195
|
+
orionis/luminate/support/introspection/instances/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
196
|
+
orionis/luminate/support/introspection/instances/contracts/reflection_instance.py,sha256=m6VEx9ixhTmWHABySuN6cDvs1QVWkIbYfiO6avd0qyQ,16543
|
194
197
|
orionis/luminate/support/introspection/instances/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
195
198
|
orionis/luminate/support/introspection/instances/entities/class_attributes.py,sha256=eQSiqCE_3ai_1FJF7VCJlLVmX3X7lEwD7bsoomd5z80,296
|
196
199
|
orionis/luminate/support/introspection/instances/entities/class_method.py,sha256=KHxd5mBCNnbtq6RhNrAk5Wu1VrblJzd629rBXMzBVZ8,473
|
@@ -247,16 +250,16 @@ tests/support/async_io/test_async_coroutine.py,sha256=rMpjIH3DDjMDIqZkaDGv1q1yGl
|
|
247
250
|
tests/support/environment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
248
251
|
tests/support/environment/test_env.py,sha256=fcMyvGnDnP2qamhG7yDRN9MyUDjeYN-oSmlno2mc7dQ,2652
|
249
252
|
tests/support/inspection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
253
|
+
tests/support/inspection/test_reflect_abstract.py,sha256=0qjK1vzDu6jt_F16esoxxMVvYF7s-ThC0oYE_oK7UgA,10590
|
250
254
|
tests/support/inspection/test_reflect_dependencies.py,sha256=frROd9NDbzwmEpb7TEOpikshFJKbPN5NvJ62ZWUm11E,3686
|
251
|
-
tests/support/inspection/test_reflect_instance.py,sha256=
|
252
|
-
tests/support/inspection/test_reflection_abstract.py,sha256=447L7TCQ5-08QKWuzpIlx0EZ9b9LjEOpR5ZMU5N2Kz0,9340
|
255
|
+
tests/support/inspection/test_reflect_instance.py,sha256=EJ8hKA1Tkw1f8MHzUGOde71fABvlZ4EtKFBbvRfvQM8,14097
|
253
256
|
tests/support/inspection/test_reflection_concrete.py,sha256=OXUG4EDW0Xa8c7TWeUuGdwRc3eQ4hoP67ZGbevg8BdU,6778
|
254
257
|
tests/support/inspection/test_reflection_concrete_with_abstract.py,sha256=7QPHwZZOpBaRTlpiXWIQ4DPYQBlnD1-XxNMtjEfMPu4,4673
|
255
258
|
tests/support/inspection/test_reflection_instance_with_abstract.py,sha256=GmY2W9S84uFCBIRsEjAAVhWbqWR7ZgOPD-AN8sAmhSM,4082
|
256
259
|
tests/support/inspection/fakes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
260
|
+
tests/support/inspection/fakes/fake_reflect_abstract.py,sha256=P1Zp39YNxuCI4G3coNbxqU_lSY9vZnk02UmREJgU5rg,5156
|
257
261
|
tests/support/inspection/fakes/fake_reflect_dependencies.py,sha256=TgLnBm31I8CE2qL-BkU_vo2XdBILfF5FvLe9VIr5J_E,797
|
258
262
|
tests/support/inspection/fakes/fake_reflect_instance.py,sha256=P5lSFiGPLLAPOIRmw4VE3YWctxlqmXARRiWMSGLrg3E,1382
|
259
|
-
tests/support/inspection/fakes/fake_reflection_abstract.py,sha256=7qtz44brfFzE4oNYi9kIsvdWP79nP2FnzSz-0bU__pg,5045
|
260
263
|
tests/support/inspection/fakes/fake_reflection_concrete.py,sha256=j6gzsxE3xq5oJ30H_Hm1RsUwEY3jOYBu4sclxtD1ayo,1047
|
261
264
|
tests/support/inspection/fakes/fake_reflection_concrete_with_abstract.py,sha256=ibCjrtNM6BMf5Z5VMvat7E6zOAk5g9z--gj4ykKJWY8,2118
|
262
265
|
tests/support/inspection/fakes/fake_reflection_instance_with_abstract.py,sha256=SfL8FuFmr650RlzXTrP4tGMfsPVZLhOxVnBXu_g1POg,1471
|
@@ -270,9 +273,9 @@ tests/support/patterns/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
270
273
|
tests/support/patterns/test_singleton.py,sha256=I0Cawq0C5mV5v2I1mLmxJeXw9Vt3B1iq1RgLePsG30I,624
|
271
274
|
tests/support/standard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
272
275
|
tests/support/standard/test_std.py,sha256=g_iU9Pa6W9XDnxwdLB_NAmD60547VAReXe_Vhyrhf4M,2032
|
273
|
-
orionis-0.
|
274
|
-
orionis-0.
|
275
|
-
orionis-0.
|
276
|
-
orionis-0.
|
277
|
-
orionis-0.
|
278
|
-
orionis-0.
|
276
|
+
orionis-0.240.0.dist-info/LICENCE,sha256=-_4cF2EBKuYVS_SQpy1uapq0oJPUU1vl_RUWSy2jJTo,1111
|
277
|
+
orionis-0.240.0.dist-info/METADATA,sha256=3-_Vp-syEwf7m3x9fCRqyOw5IkYM1rDR_YsXvEIxAPE,3003
|
278
|
+
orionis-0.240.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
279
|
+
orionis-0.240.0.dist-info/entry_points.txt,sha256=a_e0faeSqyUCVZd0MqljQ2oaHHdlsz6g9sU_bMqi5zQ,49
|
280
|
+
orionis-0.240.0.dist-info/top_level.txt,sha256=2bdoHgyGZhOtLAXS6Om8OCTmL24dUMC_L1quMe_ETbk,14
|
281
|
+
orionis-0.240.0.dist-info/RECORD,,
|
@@ -0,0 +1,273 @@
|
|
1
|
+
from abc import ABC
|
2
|
+
from orionis.luminate.support.introspection.reflection import Reflection
|
3
|
+
from orionis.luminate.test import TestCase
|
4
|
+
from tests.support.inspection.fakes.fake_reflect_abstract import FakeAbstractClass
|
5
|
+
|
6
|
+
class TestReflectAbstract(TestCase):
|
7
|
+
"""Test cases for ReflexionAbstract using FakeAbstractClass.
|
8
|
+
|
9
|
+
This test suite verifies all functionality of the ReflexionAbstract class
|
10
|
+
using FakeAbstractClass as the test subject.
|
11
|
+
"""
|
12
|
+
|
13
|
+
async def testReflectionAbstractExceptionValueError(self):
|
14
|
+
"""Class setup method.
|
15
|
+
|
16
|
+
Initializes the ReflexionAbstract instance with FakeAbstractClass
|
17
|
+
before any tests run.
|
18
|
+
"""
|
19
|
+
with self.assertRaises(ValueError):
|
20
|
+
Reflection.abstract(str)
|
21
|
+
|
22
|
+
async def testReflectionAbstractGetClassName(self):
|
23
|
+
"""Test getClassName() method.
|
24
|
+
|
25
|
+
Verifies that:
|
26
|
+
- The returned class name matches exactly
|
27
|
+
- The return type is str
|
28
|
+
"""
|
29
|
+
class_name = Reflection.abstract(FakeAbstractClass).getClassName()
|
30
|
+
self.assertEqual(class_name, "FakeAbstractClass")
|
31
|
+
self.assertIsInstance(class_name, str)
|
32
|
+
|
33
|
+
async def testReflectionAbstractGetModuleName(self):
|
34
|
+
"""Test getModuleName() method.
|
35
|
+
|
36
|
+
Verifies that:
|
37
|
+
- The module name is returned
|
38
|
+
- The name is a string
|
39
|
+
"""
|
40
|
+
module_name = Reflection.abstract(FakeAbstractClass).getModuleName()
|
41
|
+
self.assertTrue(module_name == 'tests.support.inspection.fakes.fake_reflect_abstract')
|
42
|
+
self.assertIsInstance(module_name, str)
|
43
|
+
|
44
|
+
async def testReflectionAbstractGetClass(self):
|
45
|
+
"""
|
46
|
+
Test the `getClass()` method of the `Reflection.abstract` function.
|
47
|
+
This test verifies the following:
|
48
|
+
- The method raises a `RuntimeError` when attempting to retrieve a class
|
49
|
+
from an abstract class.
|
50
|
+
- Ensures that the behavior aligns with the expected handling of abstract
|
51
|
+
classes in the reflection mechanism.
|
52
|
+
"""
|
53
|
+
with self.assertRaises(RuntimeError):
|
54
|
+
Reflection.abstract(FakeAbstractClass).getClass()
|
55
|
+
|
56
|
+
async def testReflectionAbstractGetAllAttributes(self):
|
57
|
+
"""Test getAllAttributes() method.
|
58
|
+
|
59
|
+
Verifies that:
|
60
|
+
- All attributes are detected
|
61
|
+
- No private/protected attributes are included
|
62
|
+
- Return type is correct
|
63
|
+
"""
|
64
|
+
attributes = Reflection.abstract(FakeAbstractClass).getAllAttributes()
|
65
|
+
self.print(attributes)
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
# async def testReflectionAbstractGetAbstractMethods(self):
|
81
|
+
# """Test getAbstractMethods() method.
|
82
|
+
|
83
|
+
# Verifies that:
|
84
|
+
# - All abstract methods are detected
|
85
|
+
# - No concrete methods are included
|
86
|
+
# - Return type is correct
|
87
|
+
# """
|
88
|
+
# methods = Reflection.abstract(FakeAbstractClass).getAbstractMethods()
|
89
|
+
# expected = {'abstract_method', 'another_abstract'}
|
90
|
+
# self.assertEqual(methods, expected)
|
91
|
+
# self.assertIsInstance(methods, set)
|
92
|
+
|
93
|
+
# async def testReflectionAbstractGetConcreteMethods(self):
|
94
|
+
# """Test getConcreteMethods() method.
|
95
|
+
|
96
|
+
# Verifies that:
|
97
|
+
# - Concrete methods are detected
|
98
|
+
# - Abstract methods are excluded
|
99
|
+
# - Protected/private methods are excluded
|
100
|
+
# """
|
101
|
+
# methods = Reflection.abstract(FakeAbstractClass).getConcreteMethods()
|
102
|
+
# self.assertIn('static_helper', methods)
|
103
|
+
# self.assertIn('concrete_method', methods)
|
104
|
+
# self.assertIn('decorated_method', methods)
|
105
|
+
# self.assertNotIn('abstract_method', methods)
|
106
|
+
# self.assertNotIn('_protected_method', methods)
|
107
|
+
# self.assertNotIn('__private_method', methods)
|
108
|
+
|
109
|
+
# async def testReflectionAbstractGetStaticMethods(self):
|
110
|
+
# """Test getStaticMethods() method.
|
111
|
+
|
112
|
+
# Verifies that:
|
113
|
+
# - Static methods are detected
|
114
|
+
# - Only static methods are included
|
115
|
+
# - Protected/private methods are excluded
|
116
|
+
# """
|
117
|
+
# static_methods = Reflection.abstract(FakeAbstractClass).getStaticMethods()
|
118
|
+
# self.assertIn('static_helper', static_methods)
|
119
|
+
# self.assertEqual(len(static_methods), 1)
|
120
|
+
# self.assertNotIn('create_instance', static_methods)
|
121
|
+
|
122
|
+
# async def testReflectionAbstractGetClassMethods(self):
|
123
|
+
# """Test getClassMethods() method.
|
124
|
+
|
125
|
+
# Verifies that:
|
126
|
+
# - Class methods are detected
|
127
|
+
# - Only class methods are included
|
128
|
+
# - Protected/private methods are excluded
|
129
|
+
# """
|
130
|
+
# class_methods = Reflection.abstract(FakeAbstractClass).getClassMethods()
|
131
|
+
# self.assertIn('create_instance', class_methods)
|
132
|
+
# self.assertEqual(len(class_methods), 1)
|
133
|
+
# self.assertNotIn('static_helper', class_methods)
|
134
|
+
|
135
|
+
# async def testReflectionAbstractGetProperties(self):
|
136
|
+
# """Test getProperties() method.
|
137
|
+
|
138
|
+
# Verifies that:
|
139
|
+
# - Properties are detected
|
140
|
+
# - Only properties are included
|
141
|
+
# - Protected/private properties are excluded
|
142
|
+
# """
|
143
|
+
# props = Reflection.abstract(FakeAbstractClass).getProperties()
|
144
|
+
# self.assertIn('computed_property', props)
|
145
|
+
# self.assertEqual(len(props), 1)
|
146
|
+
|
147
|
+
# async def testReflectionAbstractGetMethodSignature(self):
|
148
|
+
# """Test getMethodSignature() method.
|
149
|
+
|
150
|
+
# Verifies that:
|
151
|
+
# - Correct signature is returned
|
152
|
+
# - Parameters are properly detected
|
153
|
+
# - Return type is properly detected
|
154
|
+
# """
|
155
|
+
# sig = Reflection.abstract(FakeAbstractClass).getMethodSignature('abstract_method')
|
156
|
+
# params = list(sig.parameters.keys())
|
157
|
+
# self.assertEqual(params, ['self', 'x', 'y'])
|
158
|
+
# self.assertEqual(sig.return_annotation, int)
|
159
|
+
|
160
|
+
# async def testReflectionAbstractGetDocstring(self):
|
161
|
+
# """Test getDocstring() method.
|
162
|
+
|
163
|
+
# Verifies that:
|
164
|
+
# - Docstring is returned
|
165
|
+
# - Docstring contains expected content
|
166
|
+
# """
|
167
|
+
# doc = Reflection.abstract(FakeAbstractClass).getDocstring()
|
168
|
+
# self.assertTrue(doc.startswith("A fake abstract class"))
|
169
|
+
# self.assertIsInstance(doc, str)
|
170
|
+
|
171
|
+
# async def testReflectionAbstractGetBaseAbstractClasses(self):
|
172
|
+
# """Test getBaseAbstractClasses() method.
|
173
|
+
|
174
|
+
# Verifies that:
|
175
|
+
# - Base abstract classes are detected
|
176
|
+
# - Only abstract bases are included
|
177
|
+
# """
|
178
|
+
# bases = Reflection.abstract(FakeAbstractClass).getBaseAbstractClasses()
|
179
|
+
# self.assertEqual(bases, (ABC,))
|
180
|
+
|
181
|
+
# async def testReflectionAbstractGetInterfaceMethods(self):
|
182
|
+
# """Test getInterfaceMethods() method.
|
183
|
+
|
184
|
+
# Verifies that:
|
185
|
+
# - Interface methods are detected
|
186
|
+
# - Signatures are correct
|
187
|
+
# - Only abstract methods are included
|
188
|
+
# """
|
189
|
+
# interface = Reflection.abstract(FakeAbstractClass).getInterfaceMethods()
|
190
|
+
# self.assertEqual(len(interface), 2)
|
191
|
+
# self.assertIn('abstract_method', interface)
|
192
|
+
# sig = interface['abstract_method']
|
193
|
+
# self.assertEqual(list(sig.parameters.keys()), ['self', 'x', 'y'])
|
194
|
+
|
195
|
+
# async def testReflectionAbstractIsSubclassOf(self):
|
196
|
+
# """Test isSubclassOf() method.
|
197
|
+
|
198
|
+
# Verifies that:
|
199
|
+
# - Correctly identifies abstract base classes
|
200
|
+
# - Returns False for non-parent classes
|
201
|
+
# """
|
202
|
+
# self.assertTrue(Reflection.abstract(FakeAbstractClass).isSubclassOf(ABC))
|
203
|
+
# self.assertTrue(Reflection.abstract(FakeAbstractClass).isSubclassOf(object))
|
204
|
+
|
205
|
+
# async def testReflectionAbstractGetSourceCode(self):
|
206
|
+
# """Test getSourceCode() method.
|
207
|
+
|
208
|
+
# Verifies that:
|
209
|
+
# - Source code is returned
|
210
|
+
# - Contains class definition
|
211
|
+
# """
|
212
|
+
# source = Reflection.abstract(FakeAbstractClass).getSourceCode()
|
213
|
+
# self.assertIsNotNone(source)
|
214
|
+
# self.assertIn("class FakeAbstractClass(ABC):", source)
|
215
|
+
|
216
|
+
# async def testReflectionAbstractGetFileLocation(self):
|
217
|
+
# """Test getFileLocation() method.
|
218
|
+
|
219
|
+
# Verifies that:
|
220
|
+
# - File location is returned
|
221
|
+
# - Path ends with .py extension
|
222
|
+
# """
|
223
|
+
# location = Reflection.abstract(FakeAbstractClass).getFileLocation()
|
224
|
+
# self.assertIsNotNone(location)
|
225
|
+
# self.assertTrue('fake_reflection_abstract.py' in location)
|
226
|
+
|
227
|
+
# async def testReflectionAbstractGetAnnotations(self):
|
228
|
+
# """Test getAnnotations() method.
|
229
|
+
|
230
|
+
# Verifies that:
|
231
|
+
# - Annotations are detected
|
232
|
+
# - Class attributes are included
|
233
|
+
# """
|
234
|
+
# annotations = Reflection.abstract(FakeAbstractClass).getAnnotations()
|
235
|
+
# self.assertIn('class_attr', annotations)
|
236
|
+
# self.assertEqual(annotations['class_attr'], str)
|
237
|
+
|
238
|
+
# async def testReflectionAbstractGetDecorators(self):
|
239
|
+
# """Test getDecorators() method.
|
240
|
+
|
241
|
+
# Verifies that:
|
242
|
+
# - Decorators are detected
|
243
|
+
# - Correct number of decorators is returned
|
244
|
+
# - Decorator order is preserved
|
245
|
+
# """
|
246
|
+
# decorators = Reflection.abstract(FakeAbstractClass).getDecorators('decorated_method')
|
247
|
+
# for decorator in decorators:
|
248
|
+
# self.assertTrue(decorator in ['decorator_example', 'another_decorator'])
|
249
|
+
|
250
|
+
# async def testReflectionAbstractIsProtocol(self):
|
251
|
+
# """Test isProtocol() method.
|
252
|
+
|
253
|
+
# Verifies that:
|
254
|
+
# - Correctly identifies non-Protocol classes
|
255
|
+
# """
|
256
|
+
# self.assertFalse(Reflection.abstract(FakeAbstractClass).isProtocol())
|
257
|
+
|
258
|
+
# async def testReflectionAbstractGetRequiredAttributes(self):
|
259
|
+
# """Test getRequiredAttributes() method.
|
260
|
+
|
261
|
+
# Verifies that:
|
262
|
+
# - Returns empty set for non-Protocol classes
|
263
|
+
# """
|
264
|
+
# self.assertEqual(Reflection.abstract(FakeAbstractClass).getRequiredAttributes(), set())
|
265
|
+
|
266
|
+
# async def testReflectionAbstractGetAbstractProperties(self):
|
267
|
+
# """Test getRequiredMethods() method."""
|
268
|
+
# self.assertEqual(Reflection.abstract(FakeAbstractClass).getAbstractProperties(), set())
|
269
|
+
|
270
|
+
# async def testReflectionAbstractGetPropertySignature(self):
|
271
|
+
# """Test getPropertySignature() method."""
|
272
|
+
# signature = Reflection.abstract(FakeAbstractClass).getPropertySignature('computed_property')
|
273
|
+
# self.assertEqual(str(signature), '(self) -> float')
|
@@ -37,6 +37,7 @@ class TestReflectInstance(TestCase):
|
|
37
37
|
"""Check that getAllAttributes returns all attributes of the class."""
|
38
38
|
reflex = Reflection.instance(FakeClass())
|
39
39
|
attributes = reflex.getAllAttributes()
|
40
|
+
self.print(attributes)
|
40
41
|
self.assertTrue("public_attr" in attributes.public)
|
41
42
|
self.assertTrue("__private_attr" in attributes.private)
|
42
43
|
self.assertTrue("_protected_attr" in attributes.protected)
|
@@ -1,255 +0,0 @@
|
|
1
|
-
from abc import ABC
|
2
|
-
from orionis.luminate.support.introspection.reflection import Reflection
|
3
|
-
from orionis.luminate.test import TestCase
|
4
|
-
from tests.support.inspection.fakes.fake_reflection_abstract import FakeAbstractClass
|
5
|
-
|
6
|
-
class TestReflexionAbstract(TestCase):
|
7
|
-
"""Test cases for ReflexionAbstract using FakeAbstractClass.
|
8
|
-
|
9
|
-
This test suite verifies all functionality of the ReflexionAbstract class
|
10
|
-
using FakeAbstractClass as the test subject.
|
11
|
-
"""
|
12
|
-
|
13
|
-
async def testReflectionAbstractExceptionValueError(self):
|
14
|
-
"""Class setup method.
|
15
|
-
|
16
|
-
Initializes the ReflexionAbstract instance with FakeAbstractClass
|
17
|
-
before any tests run.
|
18
|
-
"""
|
19
|
-
with self.assertRaises(ValueError):
|
20
|
-
Reflection.abstract(str)
|
21
|
-
|
22
|
-
async def testReflectionAbstractGetClassName(self):
|
23
|
-
"""Test getClassName() method.
|
24
|
-
|
25
|
-
Verifies that:
|
26
|
-
- The returned class name matches exactly
|
27
|
-
- The return type is str
|
28
|
-
"""
|
29
|
-
class_name = Reflection.abstract(FakeAbstractClass).getClassName()
|
30
|
-
self.assertEqual(class_name, "FakeAbstractClass")
|
31
|
-
self.assertIsInstance(class_name, str)
|
32
|
-
|
33
|
-
async def testReflectionAbstractGetModuleName(self):
|
34
|
-
"""Test getModuleName() method.
|
35
|
-
|
36
|
-
Verifies that:
|
37
|
-
- The module name is returned
|
38
|
-
- The name is a string
|
39
|
-
"""
|
40
|
-
module_name = Reflection.abstract(FakeAbstractClass).getModuleName()
|
41
|
-
self.assertTrue(module_name == 'tests.support.inspection.fakes.fake_reflection_abstract')
|
42
|
-
self.assertIsInstance(module_name, str)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
async def testReflectionAbstractGetAbstractMethods(self):
|
63
|
-
"""Test getAbstractMethods() method.
|
64
|
-
|
65
|
-
Verifies that:
|
66
|
-
- All abstract methods are detected
|
67
|
-
- No concrete methods are included
|
68
|
-
- Return type is correct
|
69
|
-
"""
|
70
|
-
methods = Reflection.abstract(FakeAbstractClass).getAbstractMethods()
|
71
|
-
expected = {'abstract_method', 'another_abstract'}
|
72
|
-
self.assertEqual(methods, expected)
|
73
|
-
self.assertIsInstance(methods, set)
|
74
|
-
|
75
|
-
async def testReflectionAbstractGetConcreteMethods(self):
|
76
|
-
"""Test getConcreteMethods() method.
|
77
|
-
|
78
|
-
Verifies that:
|
79
|
-
- Concrete methods are detected
|
80
|
-
- Abstract methods are excluded
|
81
|
-
- Protected/private methods are excluded
|
82
|
-
"""
|
83
|
-
methods = Reflection.abstract(FakeAbstractClass).getConcreteMethods()
|
84
|
-
self.assertIn('static_helper', methods)
|
85
|
-
self.assertIn('concrete_method', methods)
|
86
|
-
self.assertIn('decorated_method', methods)
|
87
|
-
self.assertNotIn('abstract_method', methods)
|
88
|
-
self.assertNotIn('_protected_method', methods)
|
89
|
-
self.assertNotIn('__private_method', methods)
|
90
|
-
|
91
|
-
async def testReflectionAbstractGetStaticMethods(self):
|
92
|
-
"""Test getStaticMethods() method.
|
93
|
-
|
94
|
-
Verifies that:
|
95
|
-
- Static methods are detected
|
96
|
-
- Only static methods are included
|
97
|
-
- Protected/private methods are excluded
|
98
|
-
"""
|
99
|
-
static_methods = Reflection.abstract(FakeAbstractClass).getStaticMethods()
|
100
|
-
self.assertIn('static_helper', static_methods)
|
101
|
-
self.assertEqual(len(static_methods), 1)
|
102
|
-
self.assertNotIn('create_instance', static_methods)
|
103
|
-
|
104
|
-
async def testReflectionAbstractGetClassMethods(self):
|
105
|
-
"""Test getClassMethods() method.
|
106
|
-
|
107
|
-
Verifies that:
|
108
|
-
- Class methods are detected
|
109
|
-
- Only class methods are included
|
110
|
-
- Protected/private methods are excluded
|
111
|
-
"""
|
112
|
-
class_methods = Reflection.abstract(FakeAbstractClass).getClassMethods()
|
113
|
-
self.assertIn('create_instance', class_methods)
|
114
|
-
self.assertEqual(len(class_methods), 1)
|
115
|
-
self.assertNotIn('static_helper', class_methods)
|
116
|
-
|
117
|
-
async def testReflectionAbstractGetProperties(self):
|
118
|
-
"""Test getProperties() method.
|
119
|
-
|
120
|
-
Verifies that:
|
121
|
-
- Properties are detected
|
122
|
-
- Only properties are included
|
123
|
-
- Protected/private properties are excluded
|
124
|
-
"""
|
125
|
-
props = Reflection.abstract(FakeAbstractClass).getProperties()
|
126
|
-
self.assertIn('computed_property', props)
|
127
|
-
self.assertEqual(len(props), 1)
|
128
|
-
|
129
|
-
async def testReflectionAbstractGetMethodSignature(self):
|
130
|
-
"""Test getMethodSignature() method.
|
131
|
-
|
132
|
-
Verifies that:
|
133
|
-
- Correct signature is returned
|
134
|
-
- Parameters are properly detected
|
135
|
-
- Return type is properly detected
|
136
|
-
"""
|
137
|
-
sig = Reflection.abstract(FakeAbstractClass).getMethodSignature('abstract_method')
|
138
|
-
params = list(sig.parameters.keys())
|
139
|
-
self.assertEqual(params, ['self', 'x', 'y'])
|
140
|
-
self.assertEqual(sig.return_annotation, int)
|
141
|
-
|
142
|
-
async def testReflectionAbstractGetDocstring(self):
|
143
|
-
"""Test getDocstring() method.
|
144
|
-
|
145
|
-
Verifies that:
|
146
|
-
- Docstring is returned
|
147
|
-
- Docstring contains expected content
|
148
|
-
"""
|
149
|
-
doc = Reflection.abstract(FakeAbstractClass).getDocstring()
|
150
|
-
self.assertTrue(doc.startswith("A fake abstract class"))
|
151
|
-
self.assertIsInstance(doc, str)
|
152
|
-
|
153
|
-
async def testReflectionAbstractGetBaseAbstractClasses(self):
|
154
|
-
"""Test getBaseAbstractClasses() method.
|
155
|
-
|
156
|
-
Verifies that:
|
157
|
-
- Base abstract classes are detected
|
158
|
-
- Only abstract bases are included
|
159
|
-
"""
|
160
|
-
bases = Reflection.abstract(FakeAbstractClass).getBaseAbstractClasses()
|
161
|
-
self.assertEqual(bases, (ABC,))
|
162
|
-
|
163
|
-
async def testReflectionAbstractGetInterfaceMethods(self):
|
164
|
-
"""Test getInterfaceMethods() method.
|
165
|
-
|
166
|
-
Verifies that:
|
167
|
-
- Interface methods are detected
|
168
|
-
- Signatures are correct
|
169
|
-
- Only abstract methods are included
|
170
|
-
"""
|
171
|
-
interface = Reflection.abstract(FakeAbstractClass).getInterfaceMethods()
|
172
|
-
self.assertEqual(len(interface), 2)
|
173
|
-
self.assertIn('abstract_method', interface)
|
174
|
-
sig = interface['abstract_method']
|
175
|
-
self.assertEqual(list(sig.parameters.keys()), ['self', 'x', 'y'])
|
176
|
-
|
177
|
-
async def testReflectionAbstractIsSubclassOf(self):
|
178
|
-
"""Test isSubclassOf() method.
|
179
|
-
|
180
|
-
Verifies that:
|
181
|
-
- Correctly identifies abstract base classes
|
182
|
-
- Returns False for non-parent classes
|
183
|
-
"""
|
184
|
-
self.assertTrue(Reflection.abstract(FakeAbstractClass).isSubclassOf(ABC))
|
185
|
-
self.assertTrue(Reflection.abstract(FakeAbstractClass).isSubclassOf(object))
|
186
|
-
|
187
|
-
async def testReflectionAbstractGetSourceCode(self):
|
188
|
-
"""Test getSourceCode() method.
|
189
|
-
|
190
|
-
Verifies that:
|
191
|
-
- Source code is returned
|
192
|
-
- Contains class definition
|
193
|
-
"""
|
194
|
-
source = Reflection.abstract(FakeAbstractClass).getSourceCode()
|
195
|
-
self.assertIsNotNone(source)
|
196
|
-
self.assertIn("class FakeAbstractClass(ABC):", source)
|
197
|
-
|
198
|
-
async def testReflectionAbstractGetFileLocation(self):
|
199
|
-
"""Test getFileLocation() method.
|
200
|
-
|
201
|
-
Verifies that:
|
202
|
-
- File location is returned
|
203
|
-
- Path ends with .py extension
|
204
|
-
"""
|
205
|
-
location = Reflection.abstract(FakeAbstractClass).getFileLocation()
|
206
|
-
self.assertIsNotNone(location)
|
207
|
-
self.assertTrue('fake_reflection_abstract.py' in location)
|
208
|
-
|
209
|
-
async def testReflectionAbstractGetAnnotations(self):
|
210
|
-
"""Test getAnnotations() method.
|
211
|
-
|
212
|
-
Verifies that:
|
213
|
-
- Annotations are detected
|
214
|
-
- Class attributes are included
|
215
|
-
"""
|
216
|
-
annotations = Reflection.abstract(FakeAbstractClass).getAnnotations()
|
217
|
-
self.assertIn('class_attr', annotations)
|
218
|
-
self.assertEqual(annotations['class_attr'], str)
|
219
|
-
|
220
|
-
async def testReflectionAbstractGetDecorators(self):
|
221
|
-
"""Test getDecorators() method.
|
222
|
-
|
223
|
-
Verifies that:
|
224
|
-
- Decorators are detected
|
225
|
-
- Correct number of decorators is returned
|
226
|
-
- Decorator order is preserved
|
227
|
-
"""
|
228
|
-
decorators = Reflection.abstract(FakeAbstractClass).getDecorators('decorated_method')
|
229
|
-
for decorator in decorators:
|
230
|
-
self.assertTrue(decorator in ['decorator_example', 'another_decorator'])
|
231
|
-
|
232
|
-
async def testReflectionAbstractIsProtocol(self):
|
233
|
-
"""Test isProtocol() method.
|
234
|
-
|
235
|
-
Verifies that:
|
236
|
-
- Correctly identifies non-Protocol classes
|
237
|
-
"""
|
238
|
-
self.assertFalse(Reflection.abstract(FakeAbstractClass).isProtocol())
|
239
|
-
|
240
|
-
async def testReflectionAbstractGetRequiredAttributes(self):
|
241
|
-
"""Test getRequiredAttributes() method.
|
242
|
-
|
243
|
-
Verifies that:
|
244
|
-
- Returns empty set for non-Protocol classes
|
245
|
-
"""
|
246
|
-
self.assertEqual(Reflection.abstract(FakeAbstractClass).getRequiredAttributes(), set())
|
247
|
-
|
248
|
-
async def testReflectionAbstractGetAbstractProperties(self):
|
249
|
-
"""Test getRequiredMethods() method."""
|
250
|
-
self.assertEqual(Reflection.abstract(FakeAbstractClass).getAbstractProperties(), set())
|
251
|
-
|
252
|
-
async def testReflectionAbstractGetPropertySignature(self):
|
253
|
-
"""Test getPropertySignature() method."""
|
254
|
-
signature = Reflection.abstract(FakeAbstractClass).getPropertySignature('computed_property')
|
255
|
-
self.assertEqual(str(signature), '(self) -> float')
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|