orionis 0.546.0__py3-none-any.whl → 0.547.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/console/base/scheduler_event_listener.py +0 -17
- orionis/console/contracts/schedule_event_listener.py +0 -18
- orionis/foundation/config/app/entities/app.py +3 -2
- orionis/foundation/config/app/enums/ciphers.py +5 -19
- orionis/foundation/config/session/entities/session.py +2 -2
- orionis/metadata/framework.py +1 -1
- orionis/services/encrypter/encrypter.py +115 -0
- orionis/services/environment/dynamic/caster.py +35 -27
- orionis/services/environment/key/key_generator.py +32 -11
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/METADATA +1 -1
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/RECORD +15 -159
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/top_level.txt +0 -1
- tests/container/__init__.py +0 -0
- tests/container/context/__init__.py +0 -0
- tests/container/context/test_manager.py +0 -38
- tests/container/context/test_scope.py +0 -32
- tests/container/core/__init__.py +0 -0
- tests/container/core/test_advanced_async.py +0 -234
- tests/container/core/test_async_optimizations.py +0 -268
- tests/container/core/test_container.py +0 -453
- tests/container/core/test_singleton.py +0 -122
- tests/container/core/test_thread_safety.py +0 -90
- tests/container/entities/__init__.py +0 -0
- tests/container/entities/test_binding.py +0 -242
- tests/container/enums/__init__.py +0 -0
- tests/container/enums/test_lifetimes.py +0 -97
- tests/container/facades/__init__.py +0 -0
- tests/container/facades/test_facade.py +0 -78
- tests/container/mocks/__init__.py +0 -0
- tests/container/mocks/mock_advanced_async.py +0 -332
- tests/container/mocks/mock_async_optimizations.py +0 -407
- tests/container/mocks/mock_auto_resolution.py +0 -192
- tests/container/mocks/mock_complex_classes.py +0 -792
- tests/container/mocks/mock_simple_classes.py +0 -98
- tests/container/providers/__init__.py +0 -0
- tests/container/providers/test_providers.py +0 -55
- tests/container/validators/__init__.py +0 -0
- tests/container/validators/test_implements.py +0 -186
- tests/container/validators/test_is_abstract_class.py +0 -147
- tests/container/validators/test_is_callable.py +0 -102
- tests/container/validators/test_is_concrete_class.py +0 -160
- tests/container/validators/test_is_instance.py +0 -150
- tests/container/validators/test_is_not_subclass.py +0 -49
- tests/container/validators/test_is_subclass.py +0 -178
- tests/container/validators/test_is_valid_alias.py +0 -147
- tests/container/validators/test_lifetime.py +0 -106
- tests/example/__init__.py +0 -0
- tests/example/test_example.py +0 -725
- tests/foundation/__init__.py +0 -0
- tests/foundation/config/__init__.py +0 -0
- tests/foundation/config/app/__init__.py +0 -0
- tests/foundation/config/app/test_foundation_config_app.py +0 -262
- tests/foundation/config/auth/__init__.py +0 -0
- tests/foundation/config/auth/test_foundation_config_auth.py +0 -29
- tests/foundation/config/cache/__init__.py +0 -0
- tests/foundation/config/cache/test_foundation_config_cache.py +0 -143
- tests/foundation/config/cache/test_foundation_config_cache_file.py +0 -126
- tests/foundation/config/cache/test_foundation_config_cache_stores.py +0 -156
- tests/foundation/config/cors/__init__.py +0 -0
- tests/foundation/config/cors/test_foundation_config_cors.py +0 -190
- tests/foundation/config/database/__init__.py +0 -0
- tests/foundation/config/database/test_foundation_config_database.py +0 -158
- tests/foundation/config/database/test_foundation_config_database_connections.py +0 -203
- tests/foundation/config/database/test_foundation_config_database_mysql.py +0 -354
- tests/foundation/config/database/test_foundation_config_database_oracle.py +0 -288
- tests/foundation/config/database/test_foundation_config_database_pgsql.py +0 -257
- tests/foundation/config/database/test_foundation_config_database_sqlite.py +0 -207
- tests/foundation/config/filesystems/__init__.py +0 -0
- tests/foundation/config/filesystems/test_foundation_config_filesystems.py +0 -160
- tests/foundation/config/filesystems/test_foundation_config_filesystems_aws.py +0 -189
- tests/foundation/config/filesystems/test_foundation_config_filesystems_disks.py +0 -184
- tests/foundation/config/filesystems/test_foundation_config_filesystems_local.py +0 -143
- tests/foundation/config/filesystems/test_foundation_config_filesystems_public.py +0 -184
- tests/foundation/config/logging/__init__.py +0 -0
- tests/foundation/config/logging/test_foundation_config_logging.py +0 -112
- tests/foundation/config/logging/test_foundation_config_logging_channels.py +0 -246
- tests/foundation/config/logging/test_foundation_config_logging_chunked.py +0 -217
- tests/foundation/config/logging/test_foundation_config_logging_daily.py +0 -220
- tests/foundation/config/logging/test_foundation_config_logging_hourly.py +0 -196
- tests/foundation/config/logging/test_foundation_config_logging_monthly.py +0 -214
- tests/foundation/config/logging/test_foundation_config_logging_stack.py +0 -178
- tests/foundation/config/logging/test_foundation_config_logging_weekly.py +0 -224
- tests/foundation/config/mail/__init__.py +0 -0
- tests/foundation/config/mail/test_foundation_config_mail.py +0 -145
- tests/foundation/config/mail/test_foundation_config_mail_file.py +0 -97
- tests/foundation/config/mail/test_foundation_config_mail_mailers.py +0 -106
- tests/foundation/config/mail/test_foundation_config_mail_smtp.py +0 -146
- tests/foundation/config/queue/__init__.py +0 -0
- tests/foundation/config/queue/test_foundation_config_queue.py +0 -88
- tests/foundation/config/queue/test_foundation_config_queue_brokers.py +0 -72
- tests/foundation/config/queue/test_foundation_config_queue_database.py +0 -134
- tests/foundation/config/root/__init__.py +0 -0
- tests/foundation/config/root/test_foundation_config_root_paths.py +0 -112
- tests/foundation/config/session/__init__.py +0 -0
- tests/foundation/config/session/test_foundation_config_session.py +0 -213
- tests/foundation/config/startup/__init__.py +0 -0
- tests/foundation/config/startup/test_foundation_config_startup.py +0 -202
- tests/foundation/config/testing/__init__.py +0 -0
- tests/foundation/config/testing/test_foundation_config_testing.py +0 -235
- tests/metadata/__init__.py +0 -0
- tests/metadata/test_metadata_framework.py +0 -140
- tests/metadata/test_metadata_package.py +0 -139
- tests/services/__init__.py +0 -0
- tests/services/asynchrony/__init__.py +0 -0
- tests/services/asynchrony/test_services_asynchrony_coroutine.py +0 -85
- tests/services/environment/__init__.py +0 -0
- tests/services/environment/test_services_environment.py +0 -226
- tests/services/introspection/__init__.py +0 -0
- tests/services/introspection/dependencies/__init__.py +0 -0
- tests/services/introspection/dependencies/mocks/__init__.py +0 -0
- tests/services/introspection/dependencies/mocks/mock_user.py +0 -30
- tests/services/introspection/dependencies/mocks/mock_user_controller.py +0 -27
- tests/services/introspection/dependencies/mocks/mock_users_permissions.py +0 -41
- tests/services/introspection/dependencies/test_reflect_dependencies.py +0 -261
- tests/services/introspection/reflection/__init__.py +0 -0
- tests/services/introspection/reflection/mock/__init__.py +0 -0
- tests/services/introspection/reflection/mock/fake_reflect_instance.py +0 -1115
- tests/services/introspection/reflection/test_reflection_abstract.py +0 -1011
- tests/services/introspection/reflection/test_reflection_callable.py +0 -206
- tests/services/introspection/reflection/test_reflection_concrete.py +0 -952
- tests/services/introspection/reflection/test_reflection_instance.py +0 -1233
- tests/services/introspection/reflection/test_reflection_module.py +0 -567
- tests/services/introspection/test_reflection.py +0 -462
- tests/services/log/__init__.py +0 -0
- tests/services/log/test_log.py +0 -97
- tests/services/system/__init__.py +0 -0
- tests/services/system/test_services_system_imports.py +0 -204
- tests/services/system/test_services_system_workers.py +0 -131
- tests/support/__init__.py +0 -0
- tests/support/entities/__init__.py +0 -0
- tests/support/entities/mock_dataclass.py +0 -40
- tests/support/entities/test_base.py +0 -64
- tests/support/patterns/__init__.py +0 -0
- tests/support/patterns/singleton/__init__.py +0 -0
- tests/support/patterns/singleton/test_patterns_singleton.py +0 -39
- tests/support/standard/__init__.py +0 -0
- tests/support/standard/test_services_std.py +0 -226
- tests/support/wrapper/__init__.py +0 -0
- tests/support/wrapper/test_services_wrapper_docdict.py +0 -202
- tests/testing/__init__.py +0 -0
- tests/testing/cases/__init__.py +0 -0
- tests/testing/cases/test_testing_asynchronous.py +0 -63
- tests/testing/cases/test_testing_synchronous.py +0 -57
- tests/testing/entities/__init__.py +0 -0
- tests/testing/entities/test_testing_result.py +0 -146
- tests/testing/enums/__init__.py +0 -0
- tests/testing/enums/test_testing_status.py +0 -63
- tests/testing/output/__init__.py +0 -0
- tests/testing/output/test_testing_dumper.py +0 -29
- tests/testing/output/test_testing_printer.py +0 -42
- tests/testing/records/__init__.py +0 -0
- tests/testing/records/test_testing_records.py +0 -171
- tests/testing/test_testing_unit.py +0 -164
- tests/testing/validators/__init__.py +0 -0
- tests/testing/validators/test_testing_validators.py +0 -392
- tests/testing/view/__init__.py +0 -0
- tests/testing/view/test_render.py +0 -30
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/WHEEL +0 -0
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.546.0.dist-info → orionis-0.547.0.dist-info}/zip-safe +0 -0
|
@@ -1,1011 +0,0 @@
|
|
|
1
|
-
from orionis.services.introspection.abstract.reflection import ReflectionAbstract
|
|
2
|
-
from orionis.services.introspection.dependencies.entities.argument import Argument
|
|
3
|
-
from orionis.services.introspection.dependencies.entities.resolve_argument import ResolveArguments
|
|
4
|
-
from tests.services.introspection.reflection.mock.fake_reflect_instance import AbstractFakeClass
|
|
5
|
-
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
6
|
-
|
|
7
|
-
class TestServiceReflectionAbstract(AsyncTestCase):
|
|
8
|
-
|
|
9
|
-
async def testGetClass(self):
|
|
10
|
-
"""
|
|
11
|
-
Test the getClass method of ReflectionAbstract.
|
|
12
|
-
|
|
13
|
-
Verifies that the getClass method correctly returns the class object
|
|
14
|
-
that was passed during ReflectionAbstract instantiation.
|
|
15
|
-
|
|
16
|
-
Assertions
|
|
17
|
-
----------
|
|
18
|
-
The returned class object should be identical to the original class.
|
|
19
|
-
"""
|
|
20
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
21
|
-
cls = reflect.getClass()
|
|
22
|
-
self.assertEqual(cls, AbstractFakeClass)
|
|
23
|
-
|
|
24
|
-
async def testGetClassName(self):
|
|
25
|
-
"""
|
|
26
|
-
Test the getClassName method of ReflectionAbstract.
|
|
27
|
-
|
|
28
|
-
Verifies that the getClassName method correctly returns the name
|
|
29
|
-
of the class as a string.
|
|
30
|
-
|
|
31
|
-
Assertions
|
|
32
|
-
----------
|
|
33
|
-
The returned string should match the actual class name.
|
|
34
|
-
"""
|
|
35
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
36
|
-
class_name = reflect.getClassName()
|
|
37
|
-
self.assertEqual(class_name, 'AbstractFakeClass')
|
|
38
|
-
|
|
39
|
-
async def testGetModuleName(self):
|
|
40
|
-
"""
|
|
41
|
-
Test the getModuleName method of ReflectionAbstract.
|
|
42
|
-
|
|
43
|
-
Verifies that the getModuleName method correctly returns the fully
|
|
44
|
-
qualified module name where the class is defined.
|
|
45
|
-
|
|
46
|
-
Assertions
|
|
47
|
-
----------
|
|
48
|
-
The returned string should match the complete module path.
|
|
49
|
-
"""
|
|
50
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
51
|
-
module_name = reflect.getModuleName()
|
|
52
|
-
self.assertEqual(module_name, 'tests.services.introspection.reflection.mock.fake_reflect_instance')
|
|
53
|
-
|
|
54
|
-
async def testGetModuleWithClassName(self):
|
|
55
|
-
"""
|
|
56
|
-
Test the getModuleWithClassName method of ReflectionAbstract.
|
|
57
|
-
|
|
58
|
-
Verifies that the getModuleWithClassName method correctly returns
|
|
59
|
-
the fully qualified name combining module path and class name.
|
|
60
|
-
|
|
61
|
-
Assertions
|
|
62
|
-
----------
|
|
63
|
-
The returned string should contain the complete module path followed
|
|
64
|
-
by the class name, separated by a dot.
|
|
65
|
-
"""
|
|
66
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
67
|
-
module_with_class_name = reflect.getModuleWithClassName()
|
|
68
|
-
self.assertEqual(module_with_class_name, 'tests.services.introspection.reflection.mock.fake_reflect_instance.AbstractFakeClass')
|
|
69
|
-
|
|
70
|
-
async def testGetDocstring(self):
|
|
71
|
-
"""
|
|
72
|
-
Test the getDocstring method of ReflectionAbstract.
|
|
73
|
-
|
|
74
|
-
Verifies that the getDocstring method correctly returns the class
|
|
75
|
-
docstring as it appears in the class definition.
|
|
76
|
-
|
|
77
|
-
Assertions
|
|
78
|
-
----------
|
|
79
|
-
The returned docstring should be identical to the class's __doc__ attribute.
|
|
80
|
-
"""
|
|
81
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
82
|
-
docstring = reflect.getDocstring()
|
|
83
|
-
self.assertEqual(docstring, AbstractFakeClass.__doc__)
|
|
84
|
-
|
|
85
|
-
async def testGetBaseClasses(self):
|
|
86
|
-
"""
|
|
87
|
-
Test the getBaseClasses method of ReflectionAbstract.
|
|
88
|
-
|
|
89
|
-
Verifies that the getBaseClasses method correctly returns a collection
|
|
90
|
-
of base classes that the reflected class inherits from.
|
|
91
|
-
|
|
92
|
-
Assertions
|
|
93
|
-
----------
|
|
94
|
-
The returned collection should contain the class's base class.
|
|
95
|
-
"""
|
|
96
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
97
|
-
base_classes = reflect.getBaseClasses()
|
|
98
|
-
self.assertIn(AbstractFakeClass.__base__, base_classes)
|
|
99
|
-
|
|
100
|
-
async def testGetSourceCode(self):
|
|
101
|
-
"""
|
|
102
|
-
Test the getSourceCode method of ReflectionAbstract.
|
|
103
|
-
|
|
104
|
-
Verifies that the getSourceCode method correctly returns the source
|
|
105
|
-
code of the class as a string.
|
|
106
|
-
|
|
107
|
-
Assertions
|
|
108
|
-
----------
|
|
109
|
-
The returned source code should start with the class definition.
|
|
110
|
-
"""
|
|
111
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
112
|
-
source_code = reflect.getSourceCode()
|
|
113
|
-
self.assertTrue(source_code.startswith('class AbstractFakeClass'))
|
|
114
|
-
|
|
115
|
-
async def testGetFile(self):
|
|
116
|
-
"""
|
|
117
|
-
Test the getFile method of ReflectionAbstract.
|
|
118
|
-
|
|
119
|
-
Verifies that the getFile method correctly returns the file path
|
|
120
|
-
where the class is defined.
|
|
121
|
-
|
|
122
|
-
Assertions
|
|
123
|
-
----------
|
|
124
|
-
The returned file path should end with the expected filename.
|
|
125
|
-
"""
|
|
126
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
127
|
-
file_path = reflect.getFile()
|
|
128
|
-
self.assertTrue(file_path.endswith('fake_reflect_instance.py'))
|
|
129
|
-
|
|
130
|
-
async def testGetAnnotations(self):
|
|
131
|
-
"""
|
|
132
|
-
Test the getAnnotations method of ReflectionAbstract.
|
|
133
|
-
|
|
134
|
-
Verifies that the getAnnotations method correctly returns the type
|
|
135
|
-
annotations defined in the class.
|
|
136
|
-
|
|
137
|
-
Assertions
|
|
138
|
-
----------
|
|
139
|
-
The returned annotations should contain the expected annotated attribute.
|
|
140
|
-
"""
|
|
141
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
142
|
-
annotations = reflect.getAnnotations()
|
|
143
|
-
self.assertIn('public_attr', annotations)
|
|
144
|
-
|
|
145
|
-
async def testHasAttribute(self):
|
|
146
|
-
"""
|
|
147
|
-
Test the hasAttribute method of ReflectionAbstract.
|
|
148
|
-
|
|
149
|
-
Verifies that the hasAttribute method correctly identifies whether
|
|
150
|
-
a specific attribute exists in the class.
|
|
151
|
-
|
|
152
|
-
Assertions
|
|
153
|
-
----------
|
|
154
|
-
Should return True for existing attributes and False for non-existent ones.
|
|
155
|
-
"""
|
|
156
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
157
|
-
self.assertTrue(reflect.hasAttribute('public_attr'))
|
|
158
|
-
self.assertFalse(reflect.hasAttribute('non_existent_attr'))
|
|
159
|
-
|
|
160
|
-
async def testGetAttribute(self):
|
|
161
|
-
"""
|
|
162
|
-
Test the getAttribute method of ReflectionAbstract.
|
|
163
|
-
|
|
164
|
-
Verifies that the getAttribute method correctly retrieves the value
|
|
165
|
-
of existing attributes and returns None for non-existent ones.
|
|
166
|
-
|
|
167
|
-
Assertions
|
|
168
|
-
----------
|
|
169
|
-
Should return the correct value for existing attributes and None
|
|
170
|
-
for non-existent attributes.
|
|
171
|
-
"""
|
|
172
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
173
|
-
self.assertEqual(reflect.getAttribute('public_attr'), 42)
|
|
174
|
-
self.assertIsNone(reflect.getAttribute('non_existent_attr'))
|
|
175
|
-
|
|
176
|
-
async def testSetAttribute(self):
|
|
177
|
-
"""
|
|
178
|
-
Test the setAttribute method of ReflectionAbstract.
|
|
179
|
-
|
|
180
|
-
Verifies that the setAttribute method correctly assigns values to
|
|
181
|
-
attributes, including public, protected, and private attributes.
|
|
182
|
-
|
|
183
|
-
Assertions
|
|
184
|
-
----------
|
|
185
|
-
Should successfully set attributes with different visibility levels
|
|
186
|
-
and confirm the values are correctly assigned.
|
|
187
|
-
"""
|
|
188
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
189
|
-
self.assertTrue(reflect.setAttribute('name', 'Orionis Framework'))
|
|
190
|
-
self.assertEqual(reflect.getAttribute('name'), 'Orionis Framework')
|
|
191
|
-
self.assertTrue(reflect.setAttribute('_version', '1.x'))
|
|
192
|
-
self.assertEqual(reflect.getAttribute('_version'), '1.x')
|
|
193
|
-
self.assertTrue(reflect.setAttribute('__python', '3.13+'))
|
|
194
|
-
self.assertEqual(reflect.getAttribute('__python'), '3.13+')
|
|
195
|
-
|
|
196
|
-
async def testRemoveAttribute(self):
|
|
197
|
-
"""
|
|
198
|
-
Test the removeAttribute method of ReflectionAbstract.
|
|
199
|
-
|
|
200
|
-
Verifies that the removeAttribute method correctly removes attributes
|
|
201
|
-
from the class and returns the appropriate boolean result.
|
|
202
|
-
|
|
203
|
-
Assertions
|
|
204
|
-
----------
|
|
205
|
-
Should successfully remove existing attributes and return True,
|
|
206
|
-
then confirm the attribute no longer exists.
|
|
207
|
-
"""
|
|
208
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
209
|
-
reflect.setAttribute('new_attr', 100)
|
|
210
|
-
self.assertTrue(reflect.removeAttribute('new_attr'))
|
|
211
|
-
self.assertFalse(reflect.hasAttribute('new_attr'))
|
|
212
|
-
|
|
213
|
-
async def testGetAttributes(self):
|
|
214
|
-
"""
|
|
215
|
-
Test the getAttributes method of ReflectionAbstract.
|
|
216
|
-
|
|
217
|
-
Verifies that the getAttributes method correctly returns all attributes
|
|
218
|
-
from the class, regardless of their visibility level.
|
|
219
|
-
|
|
220
|
-
Assertions
|
|
221
|
-
----------
|
|
222
|
-
The returned collection should contain public, protected, and private attributes.
|
|
223
|
-
"""
|
|
224
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
225
|
-
attributes = reflect.getAttributes()
|
|
226
|
-
self.assertIn('public_attr', attributes)
|
|
227
|
-
self.assertIn('_protected_attr', attributes)
|
|
228
|
-
self.assertIn('__private_attr', attributes)
|
|
229
|
-
|
|
230
|
-
async def testGetPublicAttributes(self):
|
|
231
|
-
"""
|
|
232
|
-
Test the getPublicAttributes method of ReflectionAbstract.
|
|
233
|
-
|
|
234
|
-
Verifies that the getPublicAttributes method correctly returns only
|
|
235
|
-
attributes with public visibility (no leading underscore).
|
|
236
|
-
|
|
237
|
-
Assertions
|
|
238
|
-
----------
|
|
239
|
-
Should include public attributes and exclude protected and private attributes.
|
|
240
|
-
"""
|
|
241
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
242
|
-
public_attributes = reflect.getPublicAttributes()
|
|
243
|
-
self.assertIn('public_attr', public_attributes)
|
|
244
|
-
self.assertNotIn('_protected_attr', public_attributes)
|
|
245
|
-
self.assertNotIn('__private_attr', public_attributes)
|
|
246
|
-
|
|
247
|
-
async def testGetProtectedAttributes(self):
|
|
248
|
-
"""
|
|
249
|
-
Test the getProtectedAttributes method of ReflectionAbstract.
|
|
250
|
-
|
|
251
|
-
Verifies that the getProtectedAttributes method correctly returns only
|
|
252
|
-
attributes with protected visibility (single leading underscore).
|
|
253
|
-
|
|
254
|
-
Assertions
|
|
255
|
-
----------
|
|
256
|
-
Should include protected attributes and exclude public and private attributes.
|
|
257
|
-
"""
|
|
258
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
259
|
-
protected_attributes = reflect.getProtectedAttributes()
|
|
260
|
-
self.assertIn('_protected_attr', protected_attributes)
|
|
261
|
-
self.assertNotIn('public_attr', protected_attributes)
|
|
262
|
-
self.assertNotIn('__private_attr', protected_attributes)
|
|
263
|
-
|
|
264
|
-
async def testGetPrivateAttributes(self):
|
|
265
|
-
"""
|
|
266
|
-
Test the getPrivateAttributes method of ReflectionAbstract.
|
|
267
|
-
|
|
268
|
-
Verifies that the getPrivateAttributes method correctly returns only
|
|
269
|
-
attributes with private visibility (double leading underscore).
|
|
270
|
-
|
|
271
|
-
Assertions
|
|
272
|
-
----------
|
|
273
|
-
Should include private attributes and exclude public and protected attributes.
|
|
274
|
-
"""
|
|
275
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
276
|
-
private_attributes = reflect.getPrivateAttributes()
|
|
277
|
-
self.assertIn('__private_attr', private_attributes)
|
|
278
|
-
self.assertNotIn('public_attr', private_attributes)
|
|
279
|
-
self.assertNotIn('_protected_attr', private_attributes)
|
|
280
|
-
|
|
281
|
-
async def testGetDunderAttributes(self):
|
|
282
|
-
"""
|
|
283
|
-
Test the getDunderAttributes method of ReflectionAbstract.
|
|
284
|
-
|
|
285
|
-
Verifies that the getDunderAttributes method correctly returns attributes
|
|
286
|
-
that follow the dunder (double underscore) naming convention.
|
|
287
|
-
|
|
288
|
-
Assertions
|
|
289
|
-
----------
|
|
290
|
-
Should include attributes with double underscores at both ends.
|
|
291
|
-
"""
|
|
292
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
293
|
-
dunder_attributes = reflect.getDunderAttributes()
|
|
294
|
-
self.assertIn('__dd__', dunder_attributes)
|
|
295
|
-
|
|
296
|
-
async def testGetMagicAttributes(self):
|
|
297
|
-
"""
|
|
298
|
-
Test the getMagicAttributes method of ReflectionAbstract.
|
|
299
|
-
|
|
300
|
-
Verifies that the getMagicAttributes method correctly returns attributes
|
|
301
|
-
that are considered magic methods or special attributes in Python.
|
|
302
|
-
|
|
303
|
-
Assertions
|
|
304
|
-
----------
|
|
305
|
-
Should include magic attributes like dunder attributes.
|
|
306
|
-
"""
|
|
307
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
308
|
-
magic_attributes = reflect.getMagicAttributes()
|
|
309
|
-
self.assertIn('__dd__', magic_attributes)
|
|
310
|
-
|
|
311
|
-
async def testHasMethod(self):
|
|
312
|
-
"""
|
|
313
|
-
Test the hasMethod method of ReflectionAbstract.
|
|
314
|
-
|
|
315
|
-
Verifies that the hasMethod method correctly identifies whether
|
|
316
|
-
a specific method exists in the class.
|
|
317
|
-
|
|
318
|
-
Assertions
|
|
319
|
-
----------
|
|
320
|
-
Should return True for existing methods and False for non-existent ones.
|
|
321
|
-
"""
|
|
322
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
323
|
-
self.assertTrue(reflect.hasMethod('instanceSyncMethod'))
|
|
324
|
-
self.assertFalse(reflect.hasMethod('non_existent_method'))
|
|
325
|
-
|
|
326
|
-
async def testGetMethodSignature(self):
|
|
327
|
-
"""
|
|
328
|
-
Test the getMethodSignature method of ReflectionAbstract.
|
|
329
|
-
|
|
330
|
-
Verifies that the getMethodSignature method correctly returns the
|
|
331
|
-
method signature including parameters and return type annotations.
|
|
332
|
-
|
|
333
|
-
Assertions
|
|
334
|
-
----------
|
|
335
|
-
The returned signature should match the expected method signature format.
|
|
336
|
-
"""
|
|
337
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
338
|
-
signature = reflect.getMethodSignature('instanceSyncMethod')
|
|
339
|
-
self.assertEqual(str(signature), '(self, x: int, y: int) -> int')
|
|
340
|
-
|
|
341
|
-
async def testGetMethods(self):
|
|
342
|
-
"""
|
|
343
|
-
Test the getMethods method of ReflectionAbstract.
|
|
344
|
-
|
|
345
|
-
Verifies that the getMethods method correctly returns all methods
|
|
346
|
-
defined in the class, regardless of their visibility level.
|
|
347
|
-
|
|
348
|
-
Assertions
|
|
349
|
-
----------
|
|
350
|
-
The returned collection should contain the expected class methods.
|
|
351
|
-
"""
|
|
352
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
353
|
-
methods = reflect.getMethods()
|
|
354
|
-
self.assertIn('instanceSyncMethod', methods)
|
|
355
|
-
self.assertIn('instanceAsyncMethod', methods)
|
|
356
|
-
|
|
357
|
-
async def testGetPublicMethods(self):
|
|
358
|
-
"""
|
|
359
|
-
Test the getPublicMethods method of ReflectionAbstract.
|
|
360
|
-
|
|
361
|
-
Verifies that the getPublicMethods method correctly returns only
|
|
362
|
-
methods with public visibility (no leading underscore).
|
|
363
|
-
|
|
364
|
-
Assertions
|
|
365
|
-
----------
|
|
366
|
-
Should include public methods and exclude protected and private methods.
|
|
367
|
-
"""
|
|
368
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
369
|
-
public_methods = reflect.getPublicMethods()
|
|
370
|
-
self.assertIn('instanceSyncMethod', public_methods)
|
|
371
|
-
self.assertNotIn('_protected_method', public_methods)
|
|
372
|
-
self.assertNotIn('__private_method', public_methods)
|
|
373
|
-
|
|
374
|
-
async def testGetPublicSyncMethods(self):
|
|
375
|
-
"""
|
|
376
|
-
Test the getPublicSyncMethods method of ReflectionAbstract.
|
|
377
|
-
|
|
378
|
-
Verifies that the getPublicSyncMethods method correctly returns only
|
|
379
|
-
synchronous methods with public visibility.
|
|
380
|
-
|
|
381
|
-
Assertions
|
|
382
|
-
----------
|
|
383
|
-
Should include public sync methods and exclude async, protected, and private methods.
|
|
384
|
-
"""
|
|
385
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
386
|
-
public_sync_methods = reflect.getPublicSyncMethods()
|
|
387
|
-
self.assertIn('instanceSyncMethod', public_sync_methods)
|
|
388
|
-
self.assertNotIn('_protected_method', public_sync_methods)
|
|
389
|
-
self.assertNotIn('__private_method', public_sync_methods)
|
|
390
|
-
|
|
391
|
-
async def testGetPublicAsyncMethods(self):
|
|
392
|
-
"""
|
|
393
|
-
Test the getPublicAsyncMethods method of ReflectionAbstract.
|
|
394
|
-
|
|
395
|
-
Verifies that the getPublicAsyncMethods method correctly returns only
|
|
396
|
-
asynchronous methods with public visibility.
|
|
397
|
-
|
|
398
|
-
Assertions
|
|
399
|
-
----------
|
|
400
|
-
Should include public async methods and exclude sync, protected, and private methods.
|
|
401
|
-
"""
|
|
402
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
403
|
-
public_async_methods = reflect.getPublicAsyncMethods()
|
|
404
|
-
self.assertIn('instanceAsyncMethod', public_async_methods)
|
|
405
|
-
self.assertNotIn('_protected_async_method', public_async_methods)
|
|
406
|
-
self.assertNotIn('__private_async_method', public_async_methods)
|
|
407
|
-
|
|
408
|
-
async def testGetProtectedMethods(self):
|
|
409
|
-
"""
|
|
410
|
-
Test the getProtectedMethods method of ReflectionAbstract.
|
|
411
|
-
|
|
412
|
-
Verifies that the getProtectedMethods method correctly returns only
|
|
413
|
-
methods with protected visibility (single leading underscore).
|
|
414
|
-
|
|
415
|
-
Assertions
|
|
416
|
-
----------
|
|
417
|
-
Should include protected methods and exclude public and private methods.
|
|
418
|
-
"""
|
|
419
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
420
|
-
protected_methods = reflect.getProtectedMethods()
|
|
421
|
-
self.assertIn('_protectedAsyncMethod', protected_methods)
|
|
422
|
-
self.assertNotIn('instanceSyncMethod', protected_methods)
|
|
423
|
-
self.assertNotIn('__privateSyncMethod', protected_methods)
|
|
424
|
-
|
|
425
|
-
async def testGetProtectedSyncMethods(self):
|
|
426
|
-
"""
|
|
427
|
-
Test the getProtectedSyncMethods method of ReflectionAbstract.
|
|
428
|
-
|
|
429
|
-
Verifies that the getProtectedSyncMethods method correctly returns only
|
|
430
|
-
synchronous methods with protected visibility.
|
|
431
|
-
|
|
432
|
-
Assertions
|
|
433
|
-
----------
|
|
434
|
-
Should include protected sync methods and exclude async, public, and private methods.
|
|
435
|
-
"""
|
|
436
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
437
|
-
protected_sync_methods = reflect.getProtectedSyncMethods()
|
|
438
|
-
self.assertIn('_protectedsyncMethod', protected_sync_methods)
|
|
439
|
-
self.assertNotIn('instanceAsyncMethod', protected_sync_methods)
|
|
440
|
-
self.assertNotIn('__privateSyncMethod', protected_sync_methods)
|
|
441
|
-
|
|
442
|
-
async def testGetProtectedAsyncMethods(self):
|
|
443
|
-
"""
|
|
444
|
-
Test the getProtectedAsyncMethods method of ReflectionAbstract.
|
|
445
|
-
|
|
446
|
-
Verifies that the getProtectedAsyncMethods method correctly returns only
|
|
447
|
-
asynchronous methods with protected visibility.
|
|
448
|
-
|
|
449
|
-
Assertions
|
|
450
|
-
----------
|
|
451
|
-
Should include protected async methods and exclude sync, public, and private methods.
|
|
452
|
-
"""
|
|
453
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
454
|
-
protected_async_methods = reflect.getProtectedAsyncMethods()
|
|
455
|
-
self.assertIn('_protectedAsyncMethod', protected_async_methods)
|
|
456
|
-
self.assertNotIn('instanceSyncMethod', protected_async_methods)
|
|
457
|
-
self.assertNotIn('__privateSyncMethod', protected_async_methods)
|
|
458
|
-
|
|
459
|
-
async def testGetPrivateMethods(self):
|
|
460
|
-
"""
|
|
461
|
-
Test the getPrivateMethods method of ReflectionAbstract.
|
|
462
|
-
|
|
463
|
-
Verifies that the getPrivateMethods method correctly returns only
|
|
464
|
-
methods with private visibility (double leading underscore).
|
|
465
|
-
|
|
466
|
-
Assertions
|
|
467
|
-
----------
|
|
468
|
-
Should include private methods and exclude public and protected methods.
|
|
469
|
-
"""
|
|
470
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
471
|
-
private_methods = reflect.getPrivateMethods()
|
|
472
|
-
self.assertIn('__privateSyncMethod', private_methods)
|
|
473
|
-
self.assertNotIn('instanceSyncMethod', private_methods)
|
|
474
|
-
self.assertNotIn('_protectedAsyncMethod', private_methods)
|
|
475
|
-
|
|
476
|
-
async def testGetPrivateSyncMethods(self):
|
|
477
|
-
"""
|
|
478
|
-
Test the getPrivateSyncMethods method of ReflectionAbstract.
|
|
479
|
-
|
|
480
|
-
Verifies that the getPrivateSyncMethods method correctly returns only
|
|
481
|
-
synchronous methods with private visibility.
|
|
482
|
-
|
|
483
|
-
Assertions
|
|
484
|
-
----------
|
|
485
|
-
Should include private sync methods and exclude async, public, and protected methods.
|
|
486
|
-
"""
|
|
487
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
488
|
-
private_sync_methods = reflect.getPrivateSyncMethods()
|
|
489
|
-
self.assertIn('__privateSyncMethod', private_sync_methods)
|
|
490
|
-
self.assertNotIn('instanceAsyncMethod', private_sync_methods)
|
|
491
|
-
self.assertNotIn('_protectedAsyncMethod', private_sync_methods)
|
|
492
|
-
|
|
493
|
-
async def testGetPrivateAsyncMethods(self):
|
|
494
|
-
"""
|
|
495
|
-
Test the getPrivateAsyncMethods method of ReflectionAbstract.
|
|
496
|
-
|
|
497
|
-
Verifies that the getPrivateAsyncMethods method correctly returns only
|
|
498
|
-
asynchronous methods with private visibility.
|
|
499
|
-
|
|
500
|
-
Assertions
|
|
501
|
-
----------
|
|
502
|
-
Should include private async methods and exclude sync, public, and protected methods.
|
|
503
|
-
"""
|
|
504
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
505
|
-
private_async_methods = reflect.getPrivateAsyncMethods()
|
|
506
|
-
self.assertIn('__privateAsyncMethod', private_async_methods)
|
|
507
|
-
self.assertNotIn('instanceSyncMethod', private_async_methods)
|
|
508
|
-
self.assertNotIn('_protectedAsyncMethod', private_async_methods)
|
|
509
|
-
|
|
510
|
-
async def testGetPublicClassMethods(self):
|
|
511
|
-
"""
|
|
512
|
-
Test the getPublicClassMethods method of ReflectionAbstract.
|
|
513
|
-
|
|
514
|
-
Verifies that the getPublicClassMethods method correctly returns only
|
|
515
|
-
class methods with public visibility (no leading underscore).
|
|
516
|
-
|
|
517
|
-
Assertions
|
|
518
|
-
----------
|
|
519
|
-
Should include public class methods and exclude protected and private class methods.
|
|
520
|
-
"""
|
|
521
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
522
|
-
public_class_methods = reflect.getPublicClassMethods()
|
|
523
|
-
self.assertIn('classSyncMethod', public_class_methods)
|
|
524
|
-
self.assertNotIn('_protected_class_method', public_class_methods)
|
|
525
|
-
self.assertNotIn('__private_class_method', public_class_methods)
|
|
526
|
-
|
|
527
|
-
async def testGetPublicClassSyncMethods(self):
|
|
528
|
-
"""
|
|
529
|
-
Test the getPublicClassSyncMethods method of ReflectionAbstract.
|
|
530
|
-
|
|
531
|
-
Verifies that the getPublicClassSyncMethods method correctly returns only
|
|
532
|
-
synchronous class methods with public visibility.
|
|
533
|
-
|
|
534
|
-
Assertions
|
|
535
|
-
----------
|
|
536
|
-
Should include public class sync methods and exclude async, protected, and private methods.
|
|
537
|
-
"""
|
|
538
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
539
|
-
public_class_sync_methods = reflect.getPublicClassSyncMethods()
|
|
540
|
-
self.assertIn('classSyncMethod', public_class_sync_methods)
|
|
541
|
-
self.assertNotIn('_protected_class_method', public_class_sync_methods)
|
|
542
|
-
self.assertNotIn('__private_class_method', public_class_sync_methods)
|
|
543
|
-
|
|
544
|
-
async def testGetPublicClassAsyncMethods(self):
|
|
545
|
-
"""
|
|
546
|
-
Test getPublicClassAsyncMethods for public class async methods.
|
|
547
|
-
|
|
548
|
-
Returns
|
|
549
|
-
-------
|
|
550
|
-
None
|
|
551
|
-
|
|
552
|
-
Notes
|
|
553
|
-
-----
|
|
554
|
-
Ensures that only public class asynchronous methods are returned by
|
|
555
|
-
getPublicClassAsyncMethods. Public methods have no leading underscores.
|
|
556
|
-
"""
|
|
557
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
558
|
-
public_class_async_methods = reflect.getPublicClassAsyncMethods()
|
|
559
|
-
self.assertIn('classAsyncMethod', public_class_async_methods)
|
|
560
|
-
self.assertNotIn('_protected_class_async_method', public_class_async_methods)
|
|
561
|
-
self.assertNotIn('__private_class_async_method', public_class_async_methods)
|
|
562
|
-
|
|
563
|
-
async def testGetProtectedClassMethods(self):
|
|
564
|
-
"""
|
|
565
|
-
Test getProtectedClassMethods for protected class methods.
|
|
566
|
-
|
|
567
|
-
Returns
|
|
568
|
-
-------
|
|
569
|
-
None
|
|
570
|
-
|
|
571
|
-
Notes
|
|
572
|
-
-----
|
|
573
|
-
Ensures that only protected class methods (single leading underscore)
|
|
574
|
-
are returned by getProtectedClassMethods.
|
|
575
|
-
"""
|
|
576
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
577
|
-
protected_class_methods = reflect.getProtectedClassMethods()
|
|
578
|
-
self.assertIn('_classMethodProtected', protected_class_methods)
|
|
579
|
-
self.assertNotIn('classSyncMethod', protected_class_methods)
|
|
580
|
-
self.assertNotIn('__classMethodPrivate', protected_class_methods)
|
|
581
|
-
|
|
582
|
-
async def testGetProtectedClassSyncMethods(self):
|
|
583
|
-
"""
|
|
584
|
-
Test getProtectedClassSyncMethods for protected class sync methods.
|
|
585
|
-
|
|
586
|
-
Returns
|
|
587
|
-
-------
|
|
588
|
-
None
|
|
589
|
-
|
|
590
|
-
Notes
|
|
591
|
-
-----
|
|
592
|
-
Ensures that only protected synchronous class methods (single leading underscore)
|
|
593
|
-
are returned by getProtectedClassSyncMethods.
|
|
594
|
-
"""
|
|
595
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
596
|
-
protected_class_sync_methods = reflect.getProtectedClassSyncMethods()
|
|
597
|
-
self.assertIn('_classMethodProtected', protected_class_sync_methods)
|
|
598
|
-
self.assertNotIn('classSyncMethod', protected_class_sync_methods)
|
|
599
|
-
self.assertNotIn('__classSyncMethodPrivate', protected_class_sync_methods)
|
|
600
|
-
|
|
601
|
-
async def testGetProtectedClassAsyncMethods(self):
|
|
602
|
-
"""
|
|
603
|
-
Test that getProtectedClassAsyncMethods returns only protected class asynchronous methods.
|
|
604
|
-
|
|
605
|
-
Returns
|
|
606
|
-
-------
|
|
607
|
-
None
|
|
608
|
-
|
|
609
|
-
Notes
|
|
610
|
-
-----
|
|
611
|
-
Ensures that only protected class async methods (single leading underscore)
|
|
612
|
-
are included in the result, while public and private class async methods are excluded.
|
|
613
|
-
"""
|
|
614
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
615
|
-
protected_class_async_methods = reflect.getProtectedClassAsyncMethods()
|
|
616
|
-
self.assertIn('_classAsyncMethodProtected', protected_class_async_methods)
|
|
617
|
-
self.assertNotIn('classAsyncMethod', protected_class_async_methods)
|
|
618
|
-
self.assertNotIn('__classAsyncMethodPrivate', protected_class_async_methods)
|
|
619
|
-
|
|
620
|
-
async def testGetPrivateClassMethods(self):
|
|
621
|
-
"""
|
|
622
|
-
Test that getPrivateClassMethods returns only private class methods.
|
|
623
|
-
|
|
624
|
-
Returns
|
|
625
|
-
-------
|
|
626
|
-
None
|
|
627
|
-
|
|
628
|
-
Notes
|
|
629
|
-
-----
|
|
630
|
-
Ensures that only private class methods (double leading underscore)
|
|
631
|
-
are included in the result, while public and protected class methods are excluded.
|
|
632
|
-
"""
|
|
633
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
634
|
-
private_class_methods = reflect.getPrivateClassMethods()
|
|
635
|
-
self.assertIn('__classMethodPrivate', private_class_methods)
|
|
636
|
-
self.assertNotIn('classSyncMethod', private_class_methods)
|
|
637
|
-
self.assertNotIn('_classMethodProtected', private_class_methods)
|
|
638
|
-
|
|
639
|
-
async def testGetPrivateClassSyncMethods(self):
|
|
640
|
-
"""
|
|
641
|
-
Test that getPrivateClassSyncMethods returns only private synchronous class methods.
|
|
642
|
-
|
|
643
|
-
Returns
|
|
644
|
-
-------
|
|
645
|
-
None
|
|
646
|
-
|
|
647
|
-
Notes
|
|
648
|
-
-----
|
|
649
|
-
Ensures that only private synchronous class methods (double leading underscore)
|
|
650
|
-
are included in the result, while public and protected class sync methods are excluded.
|
|
651
|
-
"""
|
|
652
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
653
|
-
private_class_methods = reflect.getPrivateClassSyncMethods()
|
|
654
|
-
self.assertIn('__classMethodPrivate', private_class_methods)
|
|
655
|
-
self.assertNotIn('classSyncMethod', private_class_methods)
|
|
656
|
-
self.assertNotIn('_classMethodProtected', private_class_methods)
|
|
657
|
-
|
|
658
|
-
async def testGetPrivateClassAsyncMethods(self):
|
|
659
|
-
"""
|
|
660
|
-
Test that getPrivateClassAsyncMethods returns only private class asynchronous methods.
|
|
661
|
-
|
|
662
|
-
Returns
|
|
663
|
-
-------
|
|
664
|
-
None
|
|
665
|
-
|
|
666
|
-
Notes
|
|
667
|
-
-----
|
|
668
|
-
Ensures that only private class async methods (double leading underscore)
|
|
669
|
-
are included in the result, while public and protected class async methods are excluded.
|
|
670
|
-
"""
|
|
671
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
672
|
-
private_class_async_methods = reflect.getPrivateClassAsyncMethods()
|
|
673
|
-
self.assertIn('__classAsyncMethodPrivate', private_class_async_methods)
|
|
674
|
-
self.assertNotIn('classAsyncMethod', private_class_async_methods)
|
|
675
|
-
self.assertNotIn('_classAsyncMethodProtected', private_class_async_methods)
|
|
676
|
-
|
|
677
|
-
async def testGetPublicStaticMethods(self):
|
|
678
|
-
"""
|
|
679
|
-
Test that getPublicStaticMethods returns only public static methods.
|
|
680
|
-
|
|
681
|
-
Returns
|
|
682
|
-
-------
|
|
683
|
-
None
|
|
684
|
-
|
|
685
|
-
Notes
|
|
686
|
-
-----
|
|
687
|
-
Ensures that only public static methods (no leading underscore) are included in the result.
|
|
688
|
-
Both synchronous and asynchronous public static methods are considered.
|
|
689
|
-
"""
|
|
690
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
691
|
-
public_static_methods = reflect.getPublicStaticMethods()
|
|
692
|
-
self.assertIn('staticMethod', public_static_methods)
|
|
693
|
-
self.assertIn('staticAsyncMethod', public_static_methods)
|
|
694
|
-
self.assertNotIn('static_async_method', public_static_methods)
|
|
695
|
-
|
|
696
|
-
async def testGetPublicStaticSyncMethods(self):
|
|
697
|
-
"""
|
|
698
|
-
Test that getPublicStaticSyncMethods returns only public static synchronous methods.
|
|
699
|
-
|
|
700
|
-
Returns
|
|
701
|
-
-------
|
|
702
|
-
None
|
|
703
|
-
|
|
704
|
-
Notes
|
|
705
|
-
-----
|
|
706
|
-
Ensures that only public static synchronous methods (no leading underscore)
|
|
707
|
-
are included in the result, while async and non-public static methods are excluded.
|
|
708
|
-
"""
|
|
709
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
710
|
-
public_static_sync_methods = reflect.getPublicStaticSyncMethods()
|
|
711
|
-
self.assertIn('staticMethod', public_static_sync_methods)
|
|
712
|
-
self.assertNotIn('staticAsyncMethod', public_static_sync_methods)
|
|
713
|
-
self.assertNotIn('static_async_method', public_static_sync_methods)
|
|
714
|
-
|
|
715
|
-
async def testGetPublicStaticAsyncMethods(self):
|
|
716
|
-
"""
|
|
717
|
-
Test that getPublicStaticAsyncMethods returns only public static asynchronous methods.
|
|
718
|
-
|
|
719
|
-
Returns
|
|
720
|
-
-------
|
|
721
|
-
None
|
|
722
|
-
|
|
723
|
-
Notes
|
|
724
|
-
-----
|
|
725
|
-
Ensures that only public static asynchronous methods (no leading underscore)
|
|
726
|
-
are included in the result, while synchronous and non-public static methods are excluded.
|
|
727
|
-
"""
|
|
728
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
729
|
-
public_static_async_methods = reflect.getPublicStaticAsyncMethods()
|
|
730
|
-
self.assertIn('staticAsyncMethod', public_static_async_methods)
|
|
731
|
-
self.assertNotIn('staticMethod', public_static_async_methods)
|
|
732
|
-
self.assertNotIn('static_async_method', public_static_async_methods)
|
|
733
|
-
|
|
734
|
-
async def testGetProtectedStaticMethods(self):
|
|
735
|
-
"""
|
|
736
|
-
Test that getProtectedStaticMethods returns only protected static methods.
|
|
737
|
-
|
|
738
|
-
Returns
|
|
739
|
-
-------
|
|
740
|
-
None
|
|
741
|
-
|
|
742
|
-
Notes
|
|
743
|
-
-----
|
|
744
|
-
Ensures that only protected static methods (single leading underscore)
|
|
745
|
-
are included in the result, while public and private static methods are excluded.
|
|
746
|
-
"""
|
|
747
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
748
|
-
protected_static_methods = reflect.getProtectedStaticMethods()
|
|
749
|
-
self.assertIn('_staticMethodProtected', protected_static_methods)
|
|
750
|
-
self.assertNotIn('staticMethod', protected_static_methods)
|
|
751
|
-
self.assertNotIn('__staticMethodPrivate', protected_static_methods)
|
|
752
|
-
|
|
753
|
-
async def testGetProtectedStaticSyncMethods(self):
|
|
754
|
-
"""
|
|
755
|
-
Test that getProtectedStaticSyncMethods returns only protected static synchronous methods.
|
|
756
|
-
|
|
757
|
-
Returns
|
|
758
|
-
-------
|
|
759
|
-
None
|
|
760
|
-
|
|
761
|
-
Notes
|
|
762
|
-
-----
|
|
763
|
-
Ensures that only protected static synchronous methods (single leading underscore)
|
|
764
|
-
are included in the result, while async, public, and private static methods are excluded.
|
|
765
|
-
"""
|
|
766
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
767
|
-
protected_static_sync_methods = reflect.getProtectedStaticSyncMethods()
|
|
768
|
-
self.assertIn('_staticMethodProtected', protected_static_sync_methods)
|
|
769
|
-
self.assertNotIn('staticAsyncMethod', protected_static_sync_methods)
|
|
770
|
-
self.assertNotIn('__staticMethodPrivate', protected_static_sync_methods)
|
|
771
|
-
|
|
772
|
-
async def testGetProtectedStaticAsyncMethods(self):
|
|
773
|
-
"""
|
|
774
|
-
Test that getProtectedStaticAsyncMethods returns only protected static asynchronous methods.
|
|
775
|
-
|
|
776
|
-
Returns
|
|
777
|
-
-------
|
|
778
|
-
None
|
|
779
|
-
|
|
780
|
-
Notes
|
|
781
|
-
-----
|
|
782
|
-
Ensures that only protected static asynchronous methods (single leading underscore)
|
|
783
|
-
are included in the result, while public and private static methods are excluded.
|
|
784
|
-
"""
|
|
785
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
786
|
-
protected_static_async_methods = reflect.getProtectedStaticAsyncMethods()
|
|
787
|
-
self.assertIn('_staticAsyncMethodProtected', protected_static_async_methods)
|
|
788
|
-
self.assertNotIn('staticMethod', protected_static_async_methods)
|
|
789
|
-
self.assertNotIn('__staticMethodPrivate', protected_static_async_methods)
|
|
790
|
-
|
|
791
|
-
async def testGetPrivateStaticMethods(self):
|
|
792
|
-
"""
|
|
793
|
-
Test that getPrivateStaticMethods returns only private static methods.
|
|
794
|
-
|
|
795
|
-
Returns
|
|
796
|
-
-------
|
|
797
|
-
None
|
|
798
|
-
|
|
799
|
-
Notes
|
|
800
|
-
-----
|
|
801
|
-
Ensures that only private static methods (double leading underscore)
|
|
802
|
-
are included in the result, while public and protected static methods are excluded.
|
|
803
|
-
"""
|
|
804
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
805
|
-
private_static_methods = reflect.getPrivateStaticMethods()
|
|
806
|
-
self.assertIn('__staticMethodPrivate', private_static_methods)
|
|
807
|
-
self.assertNotIn('staticMethod', private_static_methods)
|
|
808
|
-
self.assertNotIn('_staticMethodProtected', private_static_methods)
|
|
809
|
-
|
|
810
|
-
async def testGetPrivateStaticSyncMethods(self):
|
|
811
|
-
"""
|
|
812
|
-
Test that getPrivateStaticSyncMethods returns only private static synchronous methods.
|
|
813
|
-
|
|
814
|
-
Returns
|
|
815
|
-
-------
|
|
816
|
-
None
|
|
817
|
-
|
|
818
|
-
Notes
|
|
819
|
-
-----
|
|
820
|
-
Ensures that only private static synchronous methods (double leading underscore)
|
|
821
|
-
are included in the result, while public and protected static sync methods are excluded.
|
|
822
|
-
"""
|
|
823
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
824
|
-
private_static_sync_methods = reflect.getPrivateStaticSyncMethods()
|
|
825
|
-
self.assertIn('__staticMethodPrivate', private_static_sync_methods)
|
|
826
|
-
self.assertNotIn('staticMethod', private_static_sync_methods)
|
|
827
|
-
self.assertNotIn('_staticMethodProtected', private_static_sync_methods)
|
|
828
|
-
|
|
829
|
-
async def testGetPrivateStaticAsyncMethods(self):
|
|
830
|
-
"""
|
|
831
|
-
Test that getPrivateStaticAsyncMethods returns only private static asynchronous methods.
|
|
832
|
-
|
|
833
|
-
Parameters
|
|
834
|
-
----------
|
|
835
|
-
self : TestServiceReflectionAbstract
|
|
836
|
-
The test case instance.
|
|
837
|
-
|
|
838
|
-
Returns
|
|
839
|
-
-------
|
|
840
|
-
None
|
|
841
|
-
|
|
842
|
-
Notes
|
|
843
|
-
-----
|
|
844
|
-
Ensures that only private static asynchronous methods (double leading underscore)
|
|
845
|
-
are included in the result, while public and protected static async methods are excluded.
|
|
846
|
-
"""
|
|
847
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
848
|
-
private_static_async_methods = reflect.getPrivateStaticAsyncMethods()
|
|
849
|
-
# Should include only double underscore (private) static async methods
|
|
850
|
-
self.assertIn('__staticAsyncMethodPrivate', private_static_async_methods)
|
|
851
|
-
self.assertNotIn('staticAsyncMethod', private_static_async_methods)
|
|
852
|
-
self.assertNotIn('_staticAsyncMethodProtected', private_static_async_methods)
|
|
853
|
-
|
|
854
|
-
async def testGetDunderMethods(self):
|
|
855
|
-
"""
|
|
856
|
-
Test the getDunderMethods method of ReflectionAbstract.
|
|
857
|
-
|
|
858
|
-
Verifies that the getDunderMethods method correctly returns methods
|
|
859
|
-
that follow the dunder (double underscore) naming convention.
|
|
860
|
-
|
|
861
|
-
Assertions
|
|
862
|
-
----------
|
|
863
|
-
Should include methods with double underscores at both ends like __init__.
|
|
864
|
-
"""
|
|
865
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
866
|
-
dunder_methods = reflect.getDunderMethods()
|
|
867
|
-
self.assertIn('__init__', dunder_methods)
|
|
868
|
-
|
|
869
|
-
async def testGetMagicMethods(self):
|
|
870
|
-
"""
|
|
871
|
-
Test the getMagicMethods method of ReflectionAbstract.
|
|
872
|
-
|
|
873
|
-
Verifies that the getMagicMethods method correctly returns methods
|
|
874
|
-
that are considered magic methods or special methods in Python.
|
|
875
|
-
|
|
876
|
-
Assertions
|
|
877
|
-
----------
|
|
878
|
-
Should include magic methods like dunder methods.
|
|
879
|
-
"""
|
|
880
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
881
|
-
magic_methods = reflect.getMagicMethods()
|
|
882
|
-
self.assertIn('__init__', magic_methods)
|
|
883
|
-
|
|
884
|
-
async def testGetProperties(self):
|
|
885
|
-
"""
|
|
886
|
-
Test the getProperties method of ReflectionAbstract.
|
|
887
|
-
|
|
888
|
-
Verifies that the getProperties method correctly returns all properties
|
|
889
|
-
defined in the class using the @property decorator.
|
|
890
|
-
|
|
891
|
-
Assertions
|
|
892
|
-
----------
|
|
893
|
-
The returned collection should contain the expected class properties.
|
|
894
|
-
"""
|
|
895
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
896
|
-
properties = reflect.getProperties()
|
|
897
|
-
self.assertIn('computed_public_property', properties)
|
|
898
|
-
self.assertIn('_computed_property_protected', properties)
|
|
899
|
-
self.assertIn('__computed_property_private', properties)
|
|
900
|
-
|
|
901
|
-
async def testGetPublicProperties(self):
|
|
902
|
-
"""
|
|
903
|
-
Test the getPublicProperties method of ReflectionAbstract.
|
|
904
|
-
|
|
905
|
-
Verifies that the getPublicProperties method correctly returns only
|
|
906
|
-
properties with public visibility (no leading underscore).
|
|
907
|
-
|
|
908
|
-
Assertions
|
|
909
|
-
----------
|
|
910
|
-
Should include public properties and exclude protected and private properties.
|
|
911
|
-
"""
|
|
912
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
913
|
-
public_properties = reflect.getPublicProperties()
|
|
914
|
-
self.assertIn('computed_public_property', public_properties)
|
|
915
|
-
self.assertNotIn('_computed_property_protected', public_properties)
|
|
916
|
-
self.assertNotIn('__computed_property_private', public_properties)
|
|
917
|
-
|
|
918
|
-
async def testGetProtectedProperties(self):
|
|
919
|
-
"""
|
|
920
|
-
Test the getProtectedProperties method of ReflectionAbstract.
|
|
921
|
-
|
|
922
|
-
Verifies that the getProtectedProperties method correctly returns only
|
|
923
|
-
properties with protected visibility (single leading underscore).
|
|
924
|
-
|
|
925
|
-
Assertions
|
|
926
|
-
----------
|
|
927
|
-
Should include protected properties and exclude public and private properties.
|
|
928
|
-
"""
|
|
929
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
930
|
-
protected_properties = reflect.getProtectedProperties()
|
|
931
|
-
self.assertIn('_computed_property_protected', protected_properties)
|
|
932
|
-
self.assertNotIn('computed_public_property', protected_properties)
|
|
933
|
-
self.assertNotIn('__computed_property_private', protected_properties)
|
|
934
|
-
|
|
935
|
-
async def testGetPrivateProperties(self):
|
|
936
|
-
"""
|
|
937
|
-
Test the getPrivateProperties method of ReflectionAbstract.
|
|
938
|
-
|
|
939
|
-
Verifies that the getPrivateProperties method correctly returns only
|
|
940
|
-
properties with private visibility (double leading underscore).
|
|
941
|
-
|
|
942
|
-
Assertions
|
|
943
|
-
----------
|
|
944
|
-
Should include private properties and exclude public and protected properties.
|
|
945
|
-
"""
|
|
946
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
947
|
-
private_properties = reflect.getPrivateProperties()
|
|
948
|
-
self.assertIn('__computed_property_private', private_properties)
|
|
949
|
-
self.assertNotIn('computed_public_property', private_properties)
|
|
950
|
-
self.assertNotIn('_computed_property_protected', private_properties)
|
|
951
|
-
|
|
952
|
-
async def testGetPropertySignature(self):
|
|
953
|
-
"""
|
|
954
|
-
Test the getPropertySignature method of ReflectionAbstract.
|
|
955
|
-
|
|
956
|
-
Verifies that the getPropertySignature method correctly returns the
|
|
957
|
-
signature of a property's getter method.
|
|
958
|
-
|
|
959
|
-
Assertions
|
|
960
|
-
----------
|
|
961
|
-
The returned signature should match the expected property signature format.
|
|
962
|
-
"""
|
|
963
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
964
|
-
signature = reflect.getPropertySignature('computed_public_property')
|
|
965
|
-
self.assertEqual(str(signature), '(self) -> str')
|
|
966
|
-
|
|
967
|
-
async def testGetPropertyDocstring(self):
|
|
968
|
-
"""
|
|
969
|
-
Test the getPropertyDocstring method of ReflectionAbstract.
|
|
970
|
-
|
|
971
|
-
Verifies that the getPropertyDocstring method correctly returns the
|
|
972
|
-
docstring of a property.
|
|
973
|
-
|
|
974
|
-
Assertions
|
|
975
|
-
----------
|
|
976
|
-
The returned docstring should contain the expected property documentation.
|
|
977
|
-
"""
|
|
978
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
979
|
-
docstring = reflect.getPropertyDocstring('computed_public_property')
|
|
980
|
-
self.assertIn('Abstract property for a computed', docstring)
|
|
981
|
-
|
|
982
|
-
async def testGetConstructorDependencies(self):
|
|
983
|
-
"""
|
|
984
|
-
Test the getConstructorDependencies method of ReflectionAbstract.
|
|
985
|
-
|
|
986
|
-
Verifies that the getConstructorDependencies method correctly returns
|
|
987
|
-
the dependencies required by the class constructor.
|
|
988
|
-
|
|
989
|
-
Assertions
|
|
990
|
-
----------
|
|
991
|
-
Should return a ResolveArguments instance with constructor dependencies.
|
|
992
|
-
"""
|
|
993
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
994
|
-
dependencies = reflect.getConstructorDependencies()
|
|
995
|
-
self.assertIsInstance(dependencies, ResolveArguments)
|
|
996
|
-
|
|
997
|
-
async def testGetMethodDependencies(self):
|
|
998
|
-
"""
|
|
999
|
-
Test the getMethodDependencies method of ReflectionAbstract.
|
|
1000
|
-
|
|
1001
|
-
Verifies that the getMethodDependencies method correctly returns the
|
|
1002
|
-
dependencies and parameter information for a specific method.
|
|
1003
|
-
|
|
1004
|
-
Assertions
|
|
1005
|
-
----------
|
|
1006
|
-
Should return method dependencies with correct parameter types and metadata.
|
|
1007
|
-
"""
|
|
1008
|
-
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
1009
|
-
method_deps: ResolveArguments = reflect.getMethodDependencies('instanceSyncMethod')
|
|
1010
|
-
self.assertIn('x', method_deps.unresolved)
|
|
1011
|
-
self.assertIn('y', method_deps.unresolved)
|