orionis 0.438.0__py3-none-any.whl → 0.439.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.
Files changed (23) hide show
  1. orionis/container/context/scope.py +1 -1
  2. orionis/metadata/framework.py +1 -1
  3. {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/METADATA +1 -1
  4. {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/RECORD +23 -23
  5. tests/container/context/test_manager.py +1 -0
  6. tests/container/context/test_scope.py +1 -0
  7. tests/container/core/test_container.py +45 -1
  8. tests/container/core/test_singleton.py +5 -0
  9. tests/container/core/test_thread_safety.py +2 -0
  10. tests/container/validators/test_is_not_subclass.py +0 -1
  11. tests/foundation/config/queue/test_foundation_config_queue_brokers.py +1 -0
  12. tests/foundation/config/startup/test_foundation_config_startup.py +0 -1
  13. tests/services/environment/test_services_environment.py +5 -4
  14. tests/services/introspection/reflection/mock/fake_reflect_instance.py +750 -267
  15. tests/services/introspection/reflection/test_reflection_abstract.py +167 -92
  16. tests/services/introspection/reflection/test_reflection_callable.py +85 -35
  17. tests/services/introspection/reflection/test_reflection_concrete.py +345 -226
  18. tests/services/introspection/reflection/test_reflection_instance.py +627 -273
  19. tests/services/introspection/reflection/test_reflection_module.py +346 -175
  20. {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/WHEEL +0 -0
  21. {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/licenses/LICENCE +0 -0
  22. {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/top_level.txt +0 -0
  23. {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/zip-safe +0 -0
@@ -7,9 +7,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
7
7
 
8
8
  async def testGetInstance(self):
9
9
  """
10
- Tests that the ReflectionInstance.getInstance() method returns an instance of the expected class.
11
- This test creates a ReflectionInstance with a FakeClass object, retrieves the instance using getInstance(),
12
- and asserts that the returned object is an instance of FakeClass.
10
+ Test ReflectionInstance.getInstance() method functionality.
11
+
12
+ Verifies that the getInstance() method returns the wrapped instance object
13
+ correctly. Creates a ReflectionInstance wrapper around a FakeClass object
14
+ and validates that the retrieved instance maintains its original type.
15
+
16
+ Assertions
17
+ ----------
18
+ - Retrieved instance is of type FakeClass
13
19
  """
14
20
  reflect = ReflectionInstance(FakeClass())
15
21
  instance = reflect.getInstance()
@@ -17,10 +23,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
17
23
 
18
24
  async def testGetClass(self):
19
25
  """
20
- Tests that the `getClass` method of `ReflectionInstance` returns the correct class type
21
- for the given instance.
22
- This test creates a `ReflectionInstance` with an instance of `FakeClass`, calls `getClass`,
23
- and asserts that the returned class is `FakeClass`.
26
+ Test ReflectionInstance.getClass() method functionality.
27
+
28
+ Verifies that the getClass method correctly returns the class type
29
+ of the wrapped instance object. Creates a ReflectionInstance with
30
+ a FakeClass instance and validates the returned class type.
31
+
32
+ Assertions
33
+ ----------
34
+ - Returned class equals FakeClass type
24
35
  """
25
36
  reflect = ReflectionInstance(FakeClass())
26
37
  cls = reflect.getClass()
@@ -28,9 +39,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
28
39
 
29
40
  async def testGetClassName(self):
30
41
  """
31
- Tests that the ReflectionInstance correctly retrieves the class name of the given object.
32
- This test creates an instance of FakeClass, wraps it with ReflectionInstance,
33
- and asserts that getClassName() returns the expected class name 'FakeClass'.
42
+ Test ReflectionInstance.getClassName() method functionality.
43
+
44
+ Verifies that the getClassName method correctly retrieves the string
45
+ name of the wrapped instance's class. Creates a ReflectionInstance
46
+ with a FakeClass object and validates the returned class name.
47
+
48
+ Assertions
49
+ ----------
50
+ - Returned class name equals 'FakeClass'
34
51
  """
35
52
  reflect = ReflectionInstance(FakeClass())
36
53
  class_name = reflect.getClassName()
@@ -38,12 +55,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
38
55
 
39
56
  async def testGetModuleName(self):
40
57
  """
41
- Tests that the `getModuleName` method of `ReflectionInstance` returns the correct module name
42
- for the provided `FakeClass` instance.
58
+ Test ReflectionInstance.getModuleName() method functionality.
43
59
 
44
- Asserts:
45
- The returned module name matches the expected string
46
- 'tests.services.introspection.reflection.mock.fake_reflect_instance'.
60
+ Verifies that the getModuleName method correctly returns the fully
61
+ qualified module name of the wrapped instance's class. Creates a
62
+ ReflectionInstance with a FakeClass object and validates the module path.
63
+
64
+ Assertions
65
+ ----------
66
+ - Returned module name equals 'tests.services.introspection.reflection.mock.fake_reflect_instance'
47
67
  """
48
68
  reflect = ReflectionInstance(FakeClass())
49
69
  module_name = reflect.getModuleName()
@@ -51,11 +71,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
51
71
 
52
72
  async def testGetModuleWithClassName(self):
53
73
  """
54
- Tests that the getModuleWithClassName method of ReflectionInstance returns the fully qualified
55
- module and class name of the provided instance.
74
+ Test ReflectionInstance.getModuleWithClassName() method functionality.
75
+
76
+ Verifies that the getModuleWithClassName method returns the fully qualified
77
+ module path combined with the class name. Creates a ReflectionInstance
78
+ with a FakeClass object and validates the complete module.class path.
56
79
 
57
- Asserts:
58
- The returned string matches the expected module and class path for FakeClass.
80
+ Assertions
81
+ ----------
82
+ - Returned string equals 'tests.services.introspection.reflection.mock.fake_reflect_instance.FakeClass'
59
83
  """
60
84
  reflect = ReflectionInstance(FakeClass())
61
85
  module_with_class_name = reflect.getModuleWithClassName()
@@ -63,8 +87,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
63
87
 
64
88
  async def testGetDocstring(self):
65
89
  """
66
- Test that the getDocstring method of ReflectionInstance returns the correct docstring
67
- for the provided class instance.
90
+ Test ReflectionInstance.getDocstring() method functionality.
91
+
92
+ Verifies that the getDocstring method correctly retrieves the docstring
93
+ of the wrapped instance's class. Creates a ReflectionInstance with a
94
+ FakeClass object and compares the returned docstring with the class's __doc__.
95
+
96
+ Assertions
97
+ ----------
98
+ - Returned docstring equals FakeClass.__doc__
68
99
  """
69
100
  reflect = ReflectionInstance(FakeClass())
70
101
  docstring = reflect.getDocstring()
@@ -72,11 +103,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
72
103
 
73
104
  async def testGetBaseClasses(self):
74
105
  """
75
- Tests that the getBaseClasses method of ReflectionInstance correctly retrieves
76
- the base classes of the provided instance.
106
+ Test ReflectionInstance.getBaseClasses() method functionality.
107
+
108
+ Verifies that the getBaseClasses method correctly retrieves the base
109
+ classes of the wrapped instance's class. Creates a ReflectionInstance
110
+ with a FakeClass object and validates that the base class is included.
77
111
 
78
- This test creates a ReflectionInstance for a FakeClass object, calls getBaseClasses,
79
- and asserts that FakeClass's immediate base class is included in the returned list.
112
+ Assertions
113
+ ----------
114
+ - FakeClass.__base__ is present in the returned base classes list
80
115
  """
81
116
  reflect = ReflectionInstance(FakeClass())
82
117
  base_classes = reflect.getBaseClasses()
@@ -84,9 +119,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
84
119
 
85
120
  async def testGetSourceCode(self):
86
121
  """
87
- Tests that the `getSourceCode` method of `ReflectionInstance` correctly retrieves
88
- the source code of the provided class instance. Asserts that the returned source
89
- code starts with the expected class definition.
122
+ Test ReflectionInstance.getSourceCode() method functionality.
123
+
124
+ Verifies that the getSourceCode method correctly retrieves the source
125
+ code of the wrapped instance's class. Creates a ReflectionInstance
126
+ with a FakeClass object and validates the source code content.
127
+
128
+ Assertions
129
+ ----------
130
+ - Returned source code starts with 'class FakeClass'
90
131
  """
91
132
  reflect = ReflectionInstance(FakeClass())
92
133
  source_code = reflect.getSourceCode()
@@ -94,8 +135,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
94
135
 
95
136
  async def testGetFile(self):
96
137
  """
97
- Tests that the `getFile` method of `ReflectionInstance` returns the correct file path
98
- for the given instance. Asserts that the returned file path ends with 'fake_reflect_instance.py'.
138
+ Test ReflectionInstance.getFile() method functionality.
139
+
140
+ Verifies that the getFile method correctly returns the file path
141
+ of the wrapped instance's class definition. Creates a ReflectionInstance
142
+ with a FakeClass object and validates the returned file path.
143
+
144
+ Assertions
145
+ ----------
146
+ - Returned file path ends with 'fake_reflect_instance.py'
99
147
  """
100
148
  reflect = ReflectionInstance(FakeClass())
101
149
  file_path = reflect.getFile()
@@ -103,9 +151,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
103
151
 
104
152
  async def testGetAnnotations(self):
105
153
  """
106
- Test that the ReflectionInstance.getAnnotations() method returns the correct annotations
107
- for the given FakeClass instance, specifically verifying that 'public_attr' is present
108
- in the returned annotations.
154
+ Test ReflectionInstance.getAnnotations() method functionality.
155
+
156
+ Verifies that the getAnnotations method correctly returns the type
157
+ annotations of the wrapped instance's class. Creates a ReflectionInstance
158
+ with a FakeClass object and validates the presence of expected annotations.
159
+
160
+ Assertions
161
+ ----------
162
+ - 'public_attr' annotation is present in the returned annotations
109
163
  """
110
164
  reflect = ReflectionInstance(FakeClass())
111
165
  annotations = reflect.getAnnotations()
@@ -113,10 +167,16 @@ class TestServiceReflectionInstance(AsyncTestCase):
113
167
 
114
168
  async def testHasAttribute(self):
115
169
  """
116
- Tests the hasAttribute method of the ReflectionInstance class.
170
+ Test ReflectionInstance.hasAttribute() method functionality.
171
+
172
+ Verifies that the hasAttribute method correctly identifies the presence
173
+ or absence of attributes on the wrapped instance. Tests both existing
174
+ and non-existing attributes to validate proper boolean responses.
117
175
 
118
- Verifies that hasAttribute returns True for an existing attribute ('public_attr')
119
- and False for a non-existent attribute ('non_existent_attr') on a FakeClass instance.
176
+ Assertions
177
+ ----------
178
+ - Returns True for existing attribute 'public_attr'
179
+ - Returns False for non-existent attribute 'non_existent_attr'
120
180
  """
121
181
  reflect = ReflectionInstance(FakeClass())
122
182
  self.assertTrue(reflect.hasAttribute('public_attr'))
@@ -124,11 +184,16 @@ class TestServiceReflectionInstance(AsyncTestCase):
124
184
 
125
185
  async def testGetAttribute(self):
126
186
  """
127
- Tests the `getAttribute` method of the `ReflectionInstance` class.
187
+ Test ReflectionInstance.getAttribute() method functionality.
188
+
189
+ Verifies that the getAttribute method correctly retrieves attribute
190
+ values from the wrapped instance. Tests both existing attributes
191
+ and non-existent attributes to validate proper value retrieval.
128
192
 
129
- Verifies that:
130
- - Retrieving an existing attribute ('public_attr') returns its correct value (42).
131
- - Retrieving a non-existent attribute ('non_existent_attr') returns None.
193
+ Assertions
194
+ ----------
195
+ - Returns correct value (42) for existing attribute 'public_attr'
196
+ - Returns None for non-existent attribute 'non_existent_attr'
132
197
  """
133
198
  reflect = ReflectionInstance(FakeClass())
134
199
  self.assertEqual(reflect.getAttribute('public_attr'), 42)
@@ -136,19 +201,20 @@ class TestServiceReflectionInstance(AsyncTestCase):
136
201
 
137
202
  async def testSetAttribute(self):
138
203
  """
139
- Test the setAttribute method of the ReflectionInstance class.
204
+ Test ReflectionInstance.setAttribute() method functionality.
140
205
 
141
- This test verifies that setAttribute correctly sets the value of attributes
142
- on the wrapped object, including public, protected, and private attributes.
143
- It also checks that the updated values can be retrieved using getAttribute.
206
+ Verifies that the setAttribute method correctly sets attribute values
207
+ on the wrapped instance, including public, protected, and private attributes.
208
+ Also validates that the updated values can be retrieved using getAttribute.
144
209
 
145
- Assertions:
146
- - setAttribute returns True when setting a public attribute.
147
- - The value of the public attribute is updated correctly.
148
- - setAttribute returns True when setting a protected attribute.
149
- - The value of the protected attribute is updated correctly.
150
- - setAttribute returns True when setting a private attribute.
151
- - The value of the private attribute is updated correctly.
210
+ Assertions
211
+ ----------
212
+ - setAttribute returns True when setting public attribute 'name'
213
+ - Public attribute value is updated correctly to 'Orionis Framework'
214
+ - setAttribute returns True when setting protected attribute '_version'
215
+ - Protected attribute value is updated correctly to '1.x'
216
+ - setAttribute returns True when setting private attribute '__python'
217
+ - Private attribute value is updated correctly to '3.13+'
152
218
  """
153
219
  reflect = ReflectionInstance(FakeClass())
154
220
  self.assertTrue(reflect.setAttribute('name', 'Orionis Framework'))
@@ -160,8 +226,16 @@ class TestServiceReflectionInstance(AsyncTestCase):
160
226
 
161
227
  async def testRemoveAttribute(self):
162
228
  """
163
- Test that the removeAttribute method successfully removes an attribute from the reflected instance.
164
- Verifies that the attribute is removed and no longer present after removal.
229
+ Test ReflectionInstance.removeAttribute() method functionality.
230
+
231
+ Verifies that the removeAttribute method successfully removes an attribute
232
+ from the wrapped instance. Tests the removal process by first setting
233
+ an attribute, then removing it, and validating its absence.
234
+
235
+ Assertions
236
+ ----------
237
+ - removeAttribute returns True when removing an existing attribute
238
+ - Attribute is no longer present after removal (hasAttribute returns False)
165
239
  """
166
240
  reflect = ReflectionInstance(FakeClass())
167
241
  reflect.setAttribute('new_attr', 100)
@@ -170,9 +244,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
170
244
 
171
245
  async def testGetAttributes(self):
172
246
  """
173
- Tests that the ReflectionInstance.getAttributes() method correctly retrieves
174
- all attribute names from an instance of FakeClass, including public, protected,
175
- and private attributes.
247
+ Test ReflectionInstance.getAttributes() method functionality.
248
+
249
+ Verifies that the getAttributes method correctly retrieves all attribute
250
+ names from the wrapped instance, including public, protected, and private
251
+ attributes. Tests comprehensive attribute visibility.
252
+
253
+ Assertions
254
+ ----------
255
+ - 'public_attr' is present in the returned attributes list
256
+ - '_protected_attr' is present in the returned attributes list
257
+ - '__private_attr' is present in the returned attributes list
176
258
  """
177
259
  reflect = ReflectionInstance(FakeClass())
178
260
  attributes = reflect.getAttributes()
@@ -182,12 +264,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
182
264
 
183
265
  async def testGetPublicAttributes(self):
184
266
  """
185
- Test that ReflectionInstance.getPublicAttributes() returns only public attributes of a class instance.
267
+ Test ReflectionInstance.getPublicAttributes() method functionality.
268
+
269
+ Verifies that the getPublicAttributes method returns only public attributes
270
+ of the wrapped instance, excluding protected and private attributes. Tests
271
+ proper visibility filtering based on Python naming conventions.
186
272
 
187
- This test verifies that:
188
- - Public attributes (e.g., 'public_attr') are included in the returned list.
189
- - Protected attributes (e.g., '_protected_attr') are not included.
190
- - Private attributes (e.g., '__private_attr') are not included.
273
+ Assertions
274
+ ----------
275
+ - 'public_attr' is included in the returned list
276
+ - '_protected_attr' is not included in the returned list
277
+ - '__private_attr' is not included in the returned list
191
278
  """
192
279
  reflect = ReflectionInstance(FakeClass())
193
280
  public_attributes = reflect.getPublicAttributes()
@@ -197,12 +284,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
197
284
 
198
285
  async def testGetProtectedAttributes(self):
199
286
  """
200
- Test that ReflectionInstance.getProtectedAttributes() correctly identifies protected attributes.
287
+ Test ReflectionInstance.getProtectedAttributes() method functionality.
201
288
 
202
- This test verifies that:
203
- - Protected attributes (those prefixed with a single underscore) are included in the result.
204
- - Public attributes are not included.
205
- - Private attributes (those prefixed with double underscores) are not included.
289
+ Verifies that the getProtectedAttributes method correctly identifies and
290
+ returns only protected attributes (prefixed with single underscore) of
291
+ the wrapped instance, excluding public and private attributes.
292
+
293
+ Assertions
294
+ ----------
295
+ - '_protected_attr' is included in the returned list
296
+ - 'public_attr' is not included in the returned list
297
+ - '__private_attr' is not included in the returned list
206
298
  """
207
299
  reflect = ReflectionInstance(FakeClass())
208
300
  protected_attributes = reflect.getProtectedAttributes()
@@ -212,12 +304,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
212
304
 
213
305
  async def testGetPrivateAttributes(self):
214
306
  """
215
- Test that the `getPrivateAttributes` method of `ReflectionInstance` correctly identifies and returns only the private attributes of a class instance.
307
+ Test ReflectionInstance.getPrivateAttributes() method functionality.
308
+
309
+ Verifies that the getPrivateAttributes method correctly identifies and
310
+ returns only private attributes (prefixed with double underscores) of
311
+ the wrapped instance, excluding public and protected attributes.
216
312
 
217
- This test verifies that:
218
- - The private attribute (`__private_attr`) is included in the returned list.
219
- - The public attribute (`public_attr`) is not included.
220
- - The protected attribute (`_protected_attr`) is not included.
313
+ Assertions
314
+ ----------
315
+ - '__private_attr' is included in the returned list
316
+ - 'public_attr' is not included in the returned list
317
+ - '_protected_attr' is not included in the returned list
221
318
  """
222
319
  reflect = ReflectionInstance(FakeClass())
223
320
  private_attributes = reflect.getPrivateAttributes()
@@ -227,10 +324,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
227
324
 
228
325
  async def testGetDunderAttributes(self):
229
326
  """
230
- Tests that the getDunderAttributes method of ReflectionInstance correctly retrieves
231
- all double underscore (dunder) attributes from an instance of FakeClass.
327
+ Test ReflectionInstance.getDunderAttributes() method functionality.
328
+
329
+ Verifies that the getDunderAttributes method correctly retrieves all
330
+ double underscore (dunder) attributes from the wrapped instance. Tests
331
+ the identification of special attributes with the dunder naming pattern.
232
332
 
233
- Asserts that the attribute '__dd__' is present in the returned list of dunder attributes.
333
+ Assertions
334
+ ----------
335
+ - '__dd__' is present in the returned list of dunder attributes
234
336
  """
235
337
  reflect = ReflectionInstance(FakeClass())
236
338
  dunder_attributes = reflect.getDunderAttributes()
@@ -238,8 +340,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
238
340
 
239
341
  async def testGetMagicAttributes(self):
240
342
  """
241
- Tests that the `getMagicAttributes` method of `ReflectionInstance` returns a list of magic attributes
242
- for the given instance, and verifies that the attribute '__dd__' is present in the result.
343
+ Test ReflectionInstance.getMagicAttributes() method functionality.
344
+
345
+ Verifies that the getMagicAttributes method returns a list of magic attributes
346
+ (special methods and attributes with double underscores) for the wrapped instance.
347
+ Tests the identification of Python magic/special attributes.
348
+
349
+ Assertions
350
+ ----------
351
+ - '__dd__' is present in the returned list of magic attributes
243
352
  """
244
353
  reflect = ReflectionInstance(FakeClass())
245
354
  magic_attributes = reflect.getMagicAttributes()
@@ -247,11 +356,16 @@ class TestServiceReflectionInstance(AsyncTestCase):
247
356
 
248
357
  async def testHasMethod(self):
249
358
  """
250
- Tests the hasMethod function of the ReflectionInstance class.
359
+ Test ReflectionInstance.hasMethod() method functionality.
360
+
361
+ Verifies that the hasMethod method correctly identifies the presence
362
+ or absence of methods on the wrapped instance. Tests both existing
363
+ and non-existing methods to validate proper boolean responses.
251
364
 
252
- Verifies that hasMethod correctly identifies the presence or absence of a method
253
- on the provided FakeClass instance. Asserts that 'instanceSyncMethod' exists and
254
- 'non_existent_method' does not.
365
+ Assertions
366
+ ----------
367
+ - Returns True for existing method 'instanceSyncMethod'
368
+ - Returns False for non-existent method 'non_existent_method'
255
369
  """
256
370
  reflect = ReflectionInstance(FakeClass())
257
371
  self.assertTrue(reflect.hasMethod('instanceSyncMethod'))
@@ -259,10 +373,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
259
373
 
260
374
  async def testCallMethod(self):
261
375
  """
262
- Tests the callMethod function of the ReflectionInstance class.
376
+ Test ReflectionInstance.callMethod() synchronous method functionality.
263
377
 
264
- This test verifies that calling the 'instanceSyncMethod' on a FakeClass instance
265
- via ReflectionInstance.callMethod with arguments 2 and 3 returns the expected result (5).
378
+ Verifies that the callMethod method correctly invokes synchronous methods
379
+ on the wrapped instance with arguments and returns the expected result.
380
+ Tests method execution through reflection with parameter passing.
381
+
382
+ Assertions
383
+ ----------
384
+ - Calling 'instanceSyncMethod' with arguments 2 and 3 returns 5
266
385
  """
267
386
  reflect = ReflectionInstance(FakeClass())
268
387
  result = reflect.callMethod('instanceSyncMethod', 2, 3)
@@ -270,11 +389,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
270
389
 
271
390
  async def testCallAsyncMethod(self):
272
391
  """
273
- Tests that the ReflectionInstance can correctly call an asynchronous method on an instance
274
- and return the expected result.
392
+ Test ReflectionInstance.callMethod() asynchronous method functionality.
393
+
394
+ Verifies that the callMethod method correctly invokes asynchronous methods
395
+ on the wrapped instance with arguments and returns the expected result.
396
+ Tests async method execution through reflection with parameter passing.
275
397
 
276
- This test creates a ReflectionInstance for a FakeClass object, invokes the 'instanceAsyncMethod'
277
- asynchronously with arguments 2 and 3, and asserts that the result is 5.
398
+ Assertions
399
+ ----------
400
+ - Calling 'instanceAsyncMethod' with arguments 2 and 3 returns 5
278
401
  """
279
402
  reflect = ReflectionInstance(FakeClass())
280
403
  result = await reflect.callMethod('instanceAsyncMethod', 2, 3)
@@ -282,13 +405,16 @@ class TestServiceReflectionInstance(AsyncTestCase):
282
405
 
283
406
  async def testSetMethod(self):
284
407
  """
285
- Tests the ability of ReflectionInstance to set and call both synchronous and asynchronous methods dynamically.
286
- This test:
287
- - Defines a synchronous and an asynchronous mock method.
288
- - Sets these methods on a ReflectionInstance of FakeClass using setMethod.
289
- - Calls the synchronous method using callMethod and checks the result.
290
- - Calls the asynchronous method using await callMethod and checks the result.
291
- - Asserts that both methods return the expected sum of their arguments.
408
+ Test ReflectionInstance.setMethod() method functionality.
409
+
410
+ Verifies that the setMethod method can dynamically add both synchronous
411
+ and asynchronous methods to the wrapped instance. Tests the ability to
412
+ set custom methods and then call them through the reflection interface.
413
+
414
+ Assertions
415
+ ----------
416
+ - Synchronous mock method returns expected result (5) when called with arguments 2 and 3
417
+ - Asynchronous mock method returns expected result (5) when called with arguments 2 and 3
292
418
  """
293
419
 
294
420
  def mockSyncMethod(cls:FakeClass, num1, num2):
@@ -309,9 +435,16 @@ class TestServiceReflectionInstance(AsyncTestCase):
309
435
 
310
436
  async def testRemoveMethod(self):
311
437
  """
312
- Tests the removal of a dynamically added method from a ReflectionInstance.
313
- This test adds a protected-like method to a ReflectionInstance of FakeClass,
314
- verifies its existence, removes it, and then checks that it no longer exists.
438
+ Test ReflectionInstance.removeMethod() method functionality.
439
+
440
+ Verifies that the removeMethod method can successfully remove dynamically
441
+ added methods from the wrapped instance. Tests the process of adding a
442
+ method, confirming its existence, removing it, and validating its absence.
443
+
444
+ Assertions
445
+ ----------
446
+ - Method exists after being added (hasMethod returns True)
447
+ - Method no longer exists after removal (hasMethod returns False)
315
448
  """
316
449
  def _testProtectedMethod(cls:FakeClass, x, y):
317
450
  return x + y
@@ -327,10 +460,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
327
460
 
328
461
  async def testGetMethodSignature(self):
329
462
  """
330
- Tests that the ReflectionInstance.getMethodSignature method correctly retrieves
331
- the signature of the 'instanceSyncMethod' from the FakeClass instance.
332
- Asserts that the returned signature string matches the expected format:
333
- '(self, x: int, y: int) -> int'.
463
+ Test ReflectionInstance.getMethodSignature() method functionality.
464
+
465
+ Verifies that the getMethodSignature method correctly retrieves the
466
+ signature of a specified method from the wrapped instance. Tests
467
+ signature inspection and string representation of method parameters.
468
+
469
+ Assertions
470
+ ----------
471
+ - Signature of 'instanceSyncMethod' equals '(self, x: int, y: int) -> int'
334
472
  """
335
473
  reflect = ReflectionInstance(FakeClass())
336
474
  signature = reflect.getMethodSignature('instanceSyncMethod')
@@ -338,9 +476,16 @@ class TestServiceReflectionInstance(AsyncTestCase):
338
476
 
339
477
  async def testGetMethods(self):
340
478
  """
341
- Tests that the ReflectionInstance.getMethods() method correctly retrieves the names of all instance methods,
342
- including both synchronous and asynchronous methods, from the FakeClass instance.
343
- Asserts that 'instanceSyncMethod' and 'instanceAsyncMethod' are present in the returned methods list.
479
+ Test ReflectionInstance.getMethods() method functionality.
480
+
481
+ Verifies that the getMethods method correctly retrieves the names of all
482
+ instance methods from the wrapped instance, including both synchronous
483
+ and asynchronous methods. Tests comprehensive method discovery.
484
+
485
+ Assertions
486
+ ----------
487
+ - 'instanceSyncMethod' is present in the returned methods list
488
+ - 'instanceAsyncMethod' is present in the returned methods list
344
489
  """
345
490
  reflect = ReflectionInstance(FakeClass())
346
491
  methods = reflect.getMethods()
@@ -349,11 +494,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
349
494
 
350
495
  async def testGetPublicMethods(self):
351
496
  """
352
- Tests that the `getPublicMethods` method of `ReflectionInstance` returns only the public methods of a class instance.
353
- Verifies that:
354
- - Public methods (e.g., 'instanceSyncMethod') are included in the result.
355
- - Protected methods (prefixed with a single underscore) are not included.
356
- - Private methods (prefixed with double underscores) are not included.
497
+ Test ReflectionInstance.getPublicMethods() method functionality.
498
+
499
+ Verifies that the getPublicMethods method returns only public methods
500
+ of the wrapped instance, excluding protected and private methods. Tests
501
+ method visibility filtering based on Python naming conventions.
502
+
503
+ Assertions
504
+ ----------
505
+ - 'instanceSyncMethod' is included in the returned list
506
+ - '_protected_method' is not included in the returned list
507
+ - '__private_method' is not included in the returned list
357
508
  """
358
509
  reflect = ReflectionInstance(FakeClass())
359
510
  public_methods = reflect.getPublicMethods()
@@ -363,12 +514,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
363
514
 
364
515
  async def testGetPublicSyncMethods(self):
365
516
  """
366
- Test that ReflectionInstance.getPublicSyncMethods() returns only the names of public synchronous methods.
517
+ Test ReflectionInstance.getPublicSyncMethods() method functionality.
367
518
 
368
- This test verifies that:
369
- - Public synchronous methods (e.g., 'instanceSyncMethod') are included in the result.
370
- - Protected methods (prefixed with a single underscore) are excluded.
371
- - Private methods (prefixed with double underscores) are excluded.
519
+ Verifies that the getPublicSyncMethods method returns only the names of
520
+ public synchronous methods from the wrapped instance, excluding protected
521
+ and private methods. Tests synchronous method filtering with visibility.
522
+
523
+ Assertions
524
+ ----------
525
+ - 'instanceSyncMethod' is included in the returned list
526
+ - '_protected_method' is not included in the returned list
527
+ - '__private_method' is not included in the returned list
372
528
  """
373
529
  reflect = ReflectionInstance(FakeClass())
374
530
  public_sync_methods = reflect.getPublicSyncMethods()
@@ -378,11 +534,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
378
534
 
379
535
  async def testGetPublicAsyncMethods(self):
380
536
  """
381
- Test that ReflectionInstance.getPublicAsyncMethods() correctly identifies public asynchronous methods.
537
+ Test ReflectionInstance.getPublicAsyncMethods() method functionality.
538
+
539
+ Verifies that the getPublicAsyncMethods method correctly identifies and
540
+ returns only public asynchronous methods from the wrapped instance,
541
+ excluding protected and private async methods.
382
542
 
383
- This test verifies that:
384
- - Public async methods (e.g., 'instanceAsyncMethod') are included in the returned list.
385
- - Protected (prefixed with a single underscore) and private (double underscore) async methods are not included.
543
+ Assertions
544
+ ----------
545
+ - 'instanceAsyncMethod' is included in the returned list
546
+ - '_protected_async_method' is not included in the returned list
547
+ - '__private_async_method' is not included in the returned list
386
548
  """
387
549
  reflect = ReflectionInstance(FakeClass())
388
550
  public_async_methods = reflect.getPublicAsyncMethods()
@@ -392,12 +554,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
392
554
 
393
555
  async def testGetProtectedMethods(self):
394
556
  """
395
- Test that ReflectionInstance.getProtectedMethods() correctly identifies protected methods.
557
+ Test ReflectionInstance.getProtectedMethods() method functionality.
558
+
559
+ Verifies that the getProtectedMethods method correctly identifies and
560
+ returns only protected methods (prefixed with single underscore) from
561
+ the wrapped instance, excluding public and private methods.
396
562
 
397
- This test verifies that:
398
- - Protected methods (those prefixed with a single underscore) are included in the result.
399
- - Public methods are not included.
400
- - Private methods (those prefixed with double underscores) are not included.
563
+ Assertions
564
+ ----------
565
+ - '_protectedAsyncMethod' is included in the returned list
566
+ - 'instanceSyncMethod' is not included in the returned list
567
+ - '__privateSyncMethod' is not included in the returned list
401
568
  """
402
569
  reflect = ReflectionInstance(FakeClass())
403
570
  protected_methods = reflect.getProtectedMethods()
@@ -407,11 +574,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
407
574
 
408
575
  async def testGetProtectedSyncMethods(self):
409
576
  """
410
- Test that ReflectionInstance.getProtectedSyncMethods() correctly identifies protected synchronous methods.
577
+ Test ReflectionInstance.getProtectedSyncMethods() method functionality.
411
578
 
412
- This test verifies that:
413
- - Protected synchronous methods (e.g., methods prefixed with a single underscore) are included in the result.
414
- - Asynchronous methods and private methods (e.g., methods prefixed with double underscores) are not included in the result.
579
+ Verifies that the getProtectedSyncMethods method correctly identifies and
580
+ returns only protected synchronous methods (prefixed with single underscore)
581
+ from the wrapped instance, excluding async and private methods.
582
+
583
+ Assertions
584
+ ----------
585
+ - '_protectedsyncMethod' is included in the returned list
586
+ - 'instanceAsyncMethod' is not included in the returned list
587
+ - '__privateSyncMethod' is not included in the returned list
415
588
  """
416
589
  reflect = ReflectionInstance(FakeClass())
417
590
  protected_sync_methods = reflect.getProtectedSyncMethods()
@@ -421,12 +594,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
421
594
 
422
595
  async def testGetProtectedAsyncMethods(self):
423
596
  """
424
- Test that ReflectionInstance.getProtectedAsyncMethods() correctly identifies protected asynchronous methods.
597
+ Test ReflectionInstance.getProtectedAsyncMethods() method functionality.
598
+
599
+ Verifies that the getProtectedAsyncMethods method correctly identifies and
600
+ returns only protected asynchronous methods (prefixed with single underscore)
601
+ from the wrapped instance, excluding public and private methods.
425
602
 
426
- This test verifies that:
427
- - The protected asynchronous method '_protectedAsyncMethod' is included in the returned list.
428
- - The public synchronous method 'instanceSyncMethod' is not included.
429
- - The private synchronous method '__privateSyncMethod' is not included.
603
+ Assertions
604
+ ----------
605
+ - '_protectedAsyncMethod' is included in the returned list
606
+ - 'instanceSyncMethod' is not included in the returned list
607
+ - '__privateSyncMethod' is not included in the returned list
430
608
  """
431
609
  reflect = ReflectionInstance(FakeClass())
432
610
  protected_async_methods = reflect.getProtectedAsyncMethods()
@@ -436,12 +614,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
436
614
 
437
615
  async def testGetPrivateMethods(self):
438
616
  """
439
- Test that `getPrivateMethods` correctly identifies private methods of a class instance.
617
+ Test ReflectionInstance.getPrivateMethods() method functionality.
618
+
619
+ Verifies that the getPrivateMethods method correctly identifies and
620
+ returns only private methods (prefixed with double underscores) from
621
+ the wrapped instance, excluding public and protected methods.
440
622
 
441
- This test verifies that:
442
- - The method `__privateSyncMethod` is included in the list of private methods.
443
- - The method `instanceSyncMethod` (a public method) is not included.
444
- - The method `_protectedAsyncMethod` (a protected method) is not included.
623
+ Assertions
624
+ ----------
625
+ - '__privateSyncMethod' is included in the returned list
626
+ - 'instanceSyncMethod' is not included in the returned list
627
+ - '_protectedAsyncMethod' is not included in the returned list
445
628
  """
446
629
  reflect = ReflectionInstance(FakeClass())
447
630
  private_methods = reflect.getPrivateMethods()
@@ -451,11 +634,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
451
634
 
452
635
  async def testGetPrivateSyncMethods(self):
453
636
  """
454
- Test that ReflectionInstance.getPrivateSyncMethods correctly identifies private synchronous methods.
637
+ Test ReflectionInstance.getPrivateSyncMethods() method functionality.
455
638
 
456
- This test verifies that:
457
- - The method '__privateSyncMethod' is included in the list of private synchronous methods.
458
- - The methods 'instanceAsyncMethod' and '_protectedAsyncMethod' are not included in the list.
639
+ Verifies that the getPrivateSyncMethods method correctly identifies and
640
+ returns only private synchronous methods (prefixed with double underscores)
641
+ from the wrapped instance, excluding async and protected methods.
642
+
643
+ Assertions
644
+ ----------
645
+ - '__privateSyncMethod' is included in the returned list
646
+ - 'instanceAsyncMethod' is not included in the returned list
647
+ - '_protectedAsyncMethod' is not included in the returned list
459
648
  """
460
649
  reflect = ReflectionInstance(FakeClass())
461
650
  private_sync_methods = reflect.getPrivateSyncMethods()
@@ -465,12 +654,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
465
654
 
466
655
  async def testGetPrivateAsyncMethods(self):
467
656
  """
468
- Test that ReflectionInstance.getPrivateAsyncMethods correctly identifies private asynchronous methods.
657
+ Test ReflectionInstance.getPrivateAsyncMethods() method functionality.
658
+
659
+ Verifies that the getPrivateAsyncMethods method correctly identifies and
660
+ returns only private asynchronous methods (prefixed with double underscores)
661
+ from the wrapped instance, excluding public and protected methods.
469
662
 
470
- This test verifies that:
471
- - The method '__privateAsyncMethod' is included in the list of private async methods.
472
- - The method 'instanceSyncMethod' is not included in the list.
473
- - The method '_protectedAsyncMethod' is not included in the list.
663
+ Assertions
664
+ ----------
665
+ - '__privateAsyncMethod' is included in the returned list
666
+ - 'instanceSyncMethod' is not included in the returned list
667
+ - '_protectedAsyncMethod' is not included in the returned list
474
668
  """
475
669
  reflect = ReflectionInstance(FakeClass())
476
670
  private_async_methods = reflect.getPrivateAsyncMethods()
@@ -480,11 +674,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
480
674
 
481
675
  async def testGetPublicClassMethods(self):
482
676
  """
483
- Test that `getPublicClassMethods` returns only the public class methods of the given instance.
677
+ Test ReflectionInstance.getPublicClassMethods() method functionality.
678
+
679
+ Verifies that the getPublicClassMethods method correctly identifies and
680
+ returns only public class methods from the wrapped instance, excluding
681
+ protected and private class methods.
484
682
 
485
- This test verifies that:
486
- - Public class methods (e.g., 'classSyncMethod') are included in the result.
487
- - Protected (e.g., '_protected_class_method') and private (e.g., '__private_class_method') class methods are excluded from the result.
683
+ Assertions
684
+ ----------
685
+ - 'classSyncMethod' is included in the returned list
686
+ - '_protected_class_method' is not included in the returned list
687
+ - '__private_class_method' is not included in the returned list
488
688
  """
489
689
  reflect = ReflectionInstance(FakeClass())
490
690
  public_class_methods = reflect.getPublicClassMethods()
@@ -494,11 +694,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
494
694
 
495
695
  async def testGetPublicClassSyncMethods(self):
496
696
  """
497
- Test that `getPublicClassSyncMethods` returns only public synchronous class methods.
697
+ Test ReflectionInstance.getPublicClassSyncMethods() method functionality.
498
698
 
499
- This test verifies that:
500
- - Public synchronous class methods (e.g., 'classSyncMethod') are included in the result.
501
- - Protected (methods starting with a single underscore) and private (methods starting with double underscores) class methods are excluded from the result.
699
+ Verifies that the getPublicClassSyncMethods method correctly identifies and
700
+ returns only public synchronous class methods from the wrapped instance,
701
+ excluding protected and private class methods.
702
+
703
+ Assertions
704
+ ----------
705
+ - 'classSyncMethod' is included in the returned list
706
+ - '_protected_class_method' is not included in the returned list
707
+ - '__private_class_method' is not included in the returned list
502
708
  """
503
709
  reflect = ReflectionInstance(FakeClass())
504
710
  public_class_sync_methods = reflect.getPublicClassSyncMethods()
@@ -508,11 +714,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
508
714
 
509
715
  async def testGetPublicClassAsyncMethods(self):
510
716
  """
511
- Test that ReflectionInstance.getPublicClassAsyncMethods() correctly identifies public asynchronous class methods.
717
+ Test ReflectionInstance.getPublicClassAsyncMethods() method functionality.
718
+
719
+ Verifies that the getPublicClassAsyncMethods method correctly identifies and
720
+ returns only public asynchronous class methods from the wrapped instance,
721
+ excluding protected and private async class methods.
512
722
 
513
- This test verifies that:
514
- - Public async class methods (e.g., 'classAsyncMethod') are included in the returned list.
515
- - Protected (prefixed with a single underscore) and private (prefixed with double underscores) async class methods are not included.
723
+ Assertions
724
+ ----------
725
+ - 'classAsyncMethod' is included in the returned list
726
+ - '_protected_class_async_method' is not included in the returned list
727
+ - '__private_class_async_method' is not included in the returned list
516
728
  """
517
729
  reflect = ReflectionInstance(FakeClass())
518
730
  public_class_async_methods = reflect.getPublicClassAsyncMethods()
@@ -522,12 +734,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
522
734
 
523
735
  async def testGetProtectedClassMethods(self):
524
736
  """
525
- Test that ReflectionInstance.getProtectedClassMethods() correctly identifies protected class methods.
737
+ Test ReflectionInstance.getProtectedClassMethods() method functionality.
526
738
 
527
- This test verifies that:
528
- - Protected class methods (those prefixed with a single underscore) are included in the result.
529
- - Public class methods are not included.
530
- - Private class methods (those prefixed with double underscores) are not included.
739
+ Verifies that the getProtectedClassMethods method correctly identifies and
740
+ returns only protected class methods (prefixed with single underscore) from
741
+ the wrapped instance, excluding public and private class methods.
742
+
743
+ Assertions
744
+ ----------
745
+ - '_classMethodProtected' is included in the returned list
746
+ - 'classSyncMethod' is not included in the returned list
747
+ - '__classMethodPrivate' is not included in the returned list
531
748
  """
532
749
  reflect = ReflectionInstance(FakeClass())
533
750
  protected_class_methods = reflect.getProtectedClassMethods()
@@ -537,13 +754,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
537
754
 
538
755
  async def testGetProtectedClassSyncMethods(self):
539
756
  """
540
- Test that ReflectionInstance.getProtectedClassSyncMethods correctly identifies
541
- protected (single underscore-prefixed) synchronous class methods.
757
+ Test ReflectionInstance.getProtectedClassSyncMethods() method functionality.
758
+
759
+ Verifies that the getProtectedClassSyncMethods method correctly identifies and
760
+ returns only protected synchronous class methods (prefixed with single underscore)
761
+ from the wrapped instance, excluding public and private class methods.
542
762
 
543
- Asserts that:
544
- - '_classMethodProtected' is included in the returned list.
545
- - 'classSyncMethod' (public) is not included.
546
- - '__classSyncMethodPrivate' (private, double underscore) is not included.
763
+ Assertions
764
+ ----------
765
+ - '_classMethodProtected' is included in the returned list
766
+ - 'classSyncMethod' is not included in the returned list
767
+ - '__classSyncMethodPrivate' is not included in the returned list
547
768
  """
548
769
  reflect = ReflectionInstance(FakeClass())
549
770
  protected_class_sync_methods = reflect.getProtectedClassSyncMethods()
@@ -553,12 +774,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
553
774
 
554
775
  async def testGetProtectedClassAsyncMethods(self):
555
776
  """
556
- Test that ReflectionInstance correctly retrieves protected asynchronous class methods.
777
+ Test ReflectionInstance.getProtectedClassAsyncMethods() method functionality.
778
+
779
+ Verifies that the getProtectedClassAsyncMethods method correctly identifies and
780
+ returns only protected asynchronous class methods (prefixed with single underscore)
781
+ from the wrapped instance, excluding public and private async class methods.
557
782
 
558
- This test verifies that:
559
- - Protected async class methods (those prefixed with a single underscore) are included in the result.
560
- - Public async class methods are not included.
561
- - Private async class methods (those prefixed with double underscores) are not included.
783
+ Assertions
784
+ ----------
785
+ - '_classAsyncMethodProtected' is included in the returned list
786
+ - 'classAsyncMethod' is not included in the returned list
787
+ - '__classAsyncMethodPrivate' is not included in the returned list
562
788
  """
563
789
  reflect = ReflectionInstance(FakeClass())
564
790
  protected_class_async_methods = reflect.getProtectedClassAsyncMethods()
@@ -568,12 +794,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
568
794
 
569
795
  async def testGetPrivateClassMethods(self):
570
796
  """
571
- Test that `getPrivateClassMethods` correctly identifies private class methods.
797
+ Test ReflectionInstance.getPrivateClassMethods() method functionality.
572
798
 
573
- This test verifies that:
574
- - The private class method '__classMethodPrivate' is included in the returned list.
575
- - The public class method 'classSyncMethod' is not included.
576
- - The protected class method '_classMethodProtected' is not included.
799
+ Verifies that the getPrivateClassMethods method correctly identifies and
800
+ returns only private class methods (prefixed with double underscores) from
801
+ the wrapped instance, excluding public and protected class methods.
802
+
803
+ Assertions
804
+ ----------
805
+ - '__classMethodPrivate' is included in the returned list
806
+ - 'classSyncMethod' is not included in the returned list
807
+ - '_classMethodProtected' is not included in the returned list
577
808
  """
578
809
  reflect = ReflectionInstance(FakeClass())
579
810
  private_class_methods = reflect.getPrivateClassMethods()
@@ -583,12 +814,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
583
814
 
584
815
  async def testGetPrivateClassSyncMethods(self):
585
816
  """
586
- Test that ReflectionInstance.getPrivateClassSyncMethods() correctly identifies private class-level synchronous methods.
817
+ Test ReflectionInstance.getPrivateClassSyncMethods() method functionality.
818
+
819
+ Verifies that the getPrivateClassSyncMethods method correctly identifies and
820
+ returns only private synchronous class methods (prefixed with double underscores)
821
+ from the wrapped instance, excluding public and protected class methods.
587
822
 
588
- This test verifies that:
589
- - The private class method '__classMethodPrivate' is included in the returned list.
590
- - The public class method 'classSyncMethod' is not included.
591
- - The protected class method '_classMethodProtected' is not included.
823
+ Assertions
824
+ ----------
825
+ - '__classMethodPrivate' is included in the returned list
826
+ - 'classSyncMethod' is not included in the returned list
827
+ - '_classMethodProtected' is not included in the returned list
592
828
  """
593
829
  reflect = ReflectionInstance(FakeClass())
594
830
  private_class_methods = reflect.getPrivateClassSyncMethods()
@@ -598,12 +834,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
598
834
 
599
835
  async def testGetPrivateClassAsyncMethods(self):
600
836
  """
601
- Test that ReflectionInstance correctly retrieves private class asynchronous methods.
837
+ Test ReflectionInstance.getPrivateClassAsyncMethods() method functionality.
602
838
 
603
- This test verifies that:
604
- - The private async method '__classAsyncMethodPrivate' is included in the list of private class async methods.
605
- - The public async method 'classAsyncMethod' is not included.
606
- - The protected async method '_classAsyncMethodProtected' is not included.
839
+ Verifies that the getPrivateClassAsyncMethods method correctly identifies and
840
+ returns only private asynchronous class methods (prefixed with double underscores)
841
+ from the wrapped instance, excluding public and protected async class methods.
842
+
843
+ Assertions
844
+ ----------
845
+ - '__classAsyncMethodPrivate' is included in the returned list
846
+ - 'classAsyncMethod' is not included in the returned list
847
+ - '_classAsyncMethodProtected' is not included in the returned list
607
848
  """
608
849
  reflect = ReflectionInstance(FakeClass())
609
850
  private_class_async_methods = reflect.getPrivateClassAsyncMethods()
@@ -613,13 +854,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
613
854
 
614
855
  async def testGetPublicStaticMethods(self):
615
856
  """
616
- Tests that the `getPublicStaticMethods` method of `ReflectionInstance` correctly retrieves
617
- the names of public static methods from the `FakeClass` instance.
857
+ Test ReflectionInstance.getPublicStaticMethods() method functionality.
858
+
859
+ Verifies that the getPublicStaticMethods method correctly identifies and
860
+ returns the names of public static methods from the wrapped instance,
861
+ excluding protected and private static methods.
618
862
 
619
- Asserts that:
620
- - 'staticMethod' is included in the list of public static methods.
621
- - 'staticAsyncMethod' is included in the list of public static methods.
622
- - 'static_async_method' is not included in the list of public static methods.
863
+ Assertions
864
+ ----------
865
+ - 'staticMethod' is included in the returned list
866
+ - 'staticAsyncMethod' is included in the returned list
867
+ - 'static_async_method' is not included in the returned list
623
868
  """
624
869
  reflect = ReflectionInstance(FakeClass())
625
870
  public_static_methods = reflect.getPublicStaticMethods()
@@ -629,11 +874,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
629
874
 
630
875
  async def testGetPublicStaticSyncMethods(self):
631
876
  """
632
- Test that ReflectionInstance.getPublicStaticSyncMethods() correctly identifies public static synchronous methods.
877
+ Test ReflectionInstance.getPublicStaticSyncMethods() method functionality.
878
+
879
+ Verifies that the getPublicStaticSyncMethods method correctly identifies and
880
+ returns only public static synchronous methods from the wrapped instance,
881
+ excluding async and non-public static methods.
633
882
 
634
- This test verifies that:
635
- - 'staticMethod' (a public static synchronous method) is included in the returned list.
636
- - 'staticAsyncMethod' and 'static_async_method' (presumed to be static asynchronous methods) are not included in the returned list.
883
+ Assertions
884
+ ----------
885
+ - 'staticMethod' is included in the returned list
886
+ - 'staticAsyncMethod' is not included in the returned list
887
+ - 'static_async_method' is not included in the returned list
637
888
  """
638
889
  reflect = ReflectionInstance(FakeClass())
639
890
  public_static_sync_methods = reflect.getPublicStaticSyncMethods()
@@ -643,11 +894,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
643
894
 
644
895
  async def testGetPublicStaticAsyncMethods(self):
645
896
  """
646
- Test that ReflectionInstance.getPublicStaticAsyncMethods() correctly identifies public static asynchronous methods.
897
+ Test ReflectionInstance.getPublicStaticAsyncMethods() method functionality.
647
898
 
648
- This test verifies that:
649
- - 'staticAsyncMethod' is included in the list of public static async methods.
650
- - 'staticMethod' and 'static_async_method' are not included in the list.
899
+ Verifies that the getPublicStaticAsyncMethods method correctly identifies and
900
+ returns only public static asynchronous methods from the wrapped instance,
901
+ excluding sync and non-public static methods.
902
+
903
+ Assertions
904
+ ----------
905
+ - 'staticAsyncMethod' is included in the returned list
906
+ - 'staticMethod' is not included in the returned list
907
+ - 'static_async_method' is not included in the returned list
651
908
  """
652
909
  reflect = ReflectionInstance(FakeClass())
653
910
  public_static_async_methods = reflect.getPublicStaticAsyncMethods()
@@ -657,12 +914,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
657
914
 
658
915
  async def testGetProtectedStaticMethods(self):
659
916
  """
660
- Test that ReflectionInstance.getProtectedStaticMethods() correctly identifies protected static methods.
917
+ Test ReflectionInstance.getProtectedStaticMethods() method functionality.
918
+
919
+ Verifies that the getProtectedStaticMethods method correctly identifies and
920
+ returns only protected static methods (prefixed with single underscore) from
921
+ the wrapped instance, excluding public and private static methods.
661
922
 
662
- This test verifies that:
663
- - The protected static method '_staticMethodProtected' is included in the returned list.
664
- - The public static method 'staticMethod' is not included.
665
- - The private static method '__staticMethodPrivate' is not included.
923
+ Assertions
924
+ ----------
925
+ - '_staticMethodProtected' is included in the returned list
926
+ - 'staticMethod' is not included in the returned list
927
+ - '__staticMethodPrivate' is not included in the returned list
666
928
  """
667
929
  reflect = ReflectionInstance(FakeClass())
668
930
  protected_static_methods = reflect.getProtectedStaticMethods()
@@ -672,12 +934,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
672
934
 
673
935
  async def testGetProtectedStaticSyncMethods(self):
674
936
  """
675
- Test that ReflectionInstance.getProtectedStaticSyncMethods() correctly identifies
676
- protected static synchronous methods of the FakeClass.
937
+ Test ReflectionInstance.getProtectedStaticSyncMethods() method functionality.
677
938
 
678
- Asserts that:
679
- - '_staticMethodProtected' is included in the returned list.
680
- - 'staticAsyncMethod' and '__staticMethodPrivate' are not included.
939
+ Verifies that the getProtectedStaticSyncMethods method correctly identifies and
940
+ returns only protected static synchronous methods (prefixed with single underscore)
941
+ from the wrapped instance, excluding async and non-protected static methods.
942
+
943
+ Assertions
944
+ ----------
945
+ - '_staticMethodProtected' is included in the returned list
946
+ - 'staticAsyncMethod' is not included in the returned list
947
+ - '__staticMethodPrivate' is not included in the returned list
681
948
  """
682
949
  reflect = ReflectionInstance(FakeClass())
683
950
  protected_static_sync_methods = reflect.getProtectedStaticSyncMethods()
@@ -687,12 +954,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
687
954
 
688
955
  async def testGetProtectedStaticAsyncMethods(self):
689
956
  """
690
- Test that ReflectionInstance correctly identifies protected static asynchronous methods.
957
+ Test ReflectionInstance.getProtectedStaticAsyncMethods() method functionality.
958
+
959
+ Verifies that the getProtectedStaticAsyncMethods method correctly identifies and
960
+ returns only protected static asynchronous methods (prefixed with single underscore)
961
+ from the wrapped instance, excluding public and private static methods.
691
962
 
692
- This test verifies that:
693
- - The protected static async method '_staticAsyncMethodProtected' is included in the list returned by getProtectedStaticAsyncMethods().
694
- - The public static method 'staticMethod' is not included in the list.
695
- - The private static method '__staticMethodPrivate' is not included in the list.
963
+ Assertions
964
+ ----------
965
+ - '_staticAsyncMethodProtected' is included in the returned list
966
+ - 'staticMethod' is not included in the returned list
967
+ - '__staticMethodPrivate' is not included in the returned list
696
968
  """
697
969
  reflect = ReflectionInstance(FakeClass())
698
970
  protected_static_async_methods = reflect.getProtectedStaticAsyncMethods()
@@ -702,9 +974,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
702
974
 
703
975
  async def testGetPrivateStaticMethods(self):
704
976
  """
705
- Test that `getPrivateStaticMethods` correctly identifies and returns the names of private static methods
706
- from the reflected class instance. Ensures that private static methods (those with double underscores)
707
- are included, while protected (single underscore) and public static methods are excluded from the result.
977
+ Test ReflectionInstance.getPrivateStaticMethods() method functionality.
978
+
979
+ Verifies that the getPrivateStaticMethods method correctly identifies and
980
+ returns only private static methods (prefixed with double underscores) from
981
+ the wrapped instance, excluding protected and public static methods.
982
+
983
+ Assertions
984
+ ----------
985
+ - '__staticMethodPrivate' is included in the returned list
986
+ - 'staticMethod' is not included in the returned list
987
+ - '_staticMethodProtected' is not included in the returned list
708
988
  """
709
989
  reflect = ReflectionInstance(FakeClass())
710
990
  private_static_methods = reflect.getPrivateStaticMethods()
@@ -714,11 +994,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
714
994
 
715
995
  async def testGetPrivateStaticSyncMethods(self):
716
996
  """
717
- Test that ReflectionInstance.getPrivateStaticSyncMethods() correctly identifies private static synchronous methods.
997
+ Test ReflectionInstance.getPrivateStaticSyncMethods() method functionality.
998
+
999
+ Verifies that the getPrivateStaticSyncMethods method correctly identifies and
1000
+ returns only private static synchronous methods (prefixed with double underscores)
1001
+ from the wrapped instance, excluding public and protected static methods.
718
1002
 
719
- This test verifies that:
720
- - The method '__staticMethodPrivate' (a private static sync method) is included in the returned list.
721
- - The methods 'staticMethod' (public) and '_staticMethodProtected' (protected) are not included in the returned list.
1003
+ Assertions
1004
+ ----------
1005
+ - '__staticMethodPrivate' is included in the returned list
1006
+ - 'staticMethod' is not included in the returned list
1007
+ - '_staticMethodProtected' is not included in the returned list
722
1008
  """
723
1009
  reflect = ReflectionInstance(FakeClass())
724
1010
  private_static_sync_methods = reflect.getPrivateStaticSyncMethods()
@@ -728,11 +1014,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
728
1014
 
729
1015
  async def testGetPrivateStaticAsyncMethods(self):
730
1016
  """
731
- Test that ReflectionInstance correctly identifies private static asynchronous methods.
1017
+ Test ReflectionInstance.getPrivateStaticAsyncMethods() method functionality.
1018
+
1019
+ Verifies that the getPrivateStaticAsyncMethods method correctly identifies and
1020
+ returns only private static asynchronous methods (prefixed with double underscores)
1021
+ from the wrapped instance, excluding public and protected static async methods.
732
1022
 
733
- This test verifies that:
734
- - The list of private static async methods includes '__staticAsyncMethodPrivate'.
735
- - The list does not include 'staticAsyncMethod' (public) or '_staticAsyncMethodProtected' (protected).
1023
+ Assertions
1024
+ ----------
1025
+ - '__staticAsyncMethodPrivate' is included in the returned list
1026
+ - 'staticAsyncMethod' is not included in the returned list
1027
+ - '_staticAsyncMethodProtected' is not included in the returned list
736
1028
  """
737
1029
  reflect = ReflectionInstance(FakeClass())
738
1030
  private_static_async_methods = reflect.getPrivateStaticAsyncMethods()
@@ -742,8 +1034,16 @@ class TestServiceReflectionInstance(AsyncTestCase):
742
1034
 
743
1035
  async def testGetDunderMethods(self):
744
1036
  """
745
- Test that the getDunderMethods method of ReflectionInstance returns a list containing
746
- dunder (double underscore) methods of the given instance, such as '__init__' and '__class__'.
1037
+ Test ReflectionInstance.getDunderMethods() method functionality.
1038
+
1039
+ Verifies that the getDunderMethods method correctly identifies and returns
1040
+ dunder (double underscore) methods from the wrapped instance. Tests the
1041
+ detection of special Python methods with double underscore prefix and suffix.
1042
+
1043
+ Assertions
1044
+ ----------
1045
+ - '__init__' is present in the returned list
1046
+ - '__class__' is present in the returned list
747
1047
  """
748
1048
  reflect = ReflectionInstance(FakeClass())
749
1049
  dunder_methods = reflect.getDunderMethods()
@@ -752,11 +1052,16 @@ class TestServiceReflectionInstance(AsyncTestCase):
752
1052
 
753
1053
  async def testGetMagicMethods(self):
754
1054
  """
755
- Tests that the ReflectionInstance.getMagicMethods() method correctly retrieves
756
- the list of magic methods from the given FakeClass instance.
1055
+ Test ReflectionInstance.getMagicMethods() method functionality.
1056
+
1057
+ Verifies that the getMagicMethods method correctly identifies and returns
1058
+ magic methods (special Python methods with double underscores) from the
1059
+ wrapped instance. Tests the detection of commonly expected magic methods.
757
1060
 
758
- Asserts that commonly expected magic methods such as '__init__' and '__class__'
759
- are present in the returned list.
1061
+ Assertions
1062
+ ----------
1063
+ - '__init__' is present in the returned list
1064
+ - '__class__' is present in the returned list
760
1065
  """
761
1066
  reflect = ReflectionInstance(FakeClass())
762
1067
  magic_methods = reflect.getMagicMethods()
@@ -765,8 +1070,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
765
1070
 
766
1071
  async def testGetProperties(self):
767
1072
  """
768
- Test that ReflectionInstance.getProperties() returns all expected properties,
769
- including public, protected, and private computed properties of the target class.
1073
+ Test ReflectionInstance.getProperties() method functionality.
1074
+
1075
+ Verifies that the getProperties method correctly identifies and returns all
1076
+ properties (computed properties) from the wrapped instance, including public,
1077
+ protected, and private properties.
1078
+
1079
+ Assertions
1080
+ ----------
1081
+ - 'computed_public_property' is present in the returned list
1082
+ - '_computed_property_protected' is present in the returned list
1083
+ - '__computed_property_private' is present in the returned list
770
1084
  """
771
1085
  reflect = ReflectionInstance(FakeClass())
772
1086
  properties = reflect.getProperties()
@@ -776,13 +1090,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
776
1090
 
777
1091
  async def testGetPublicProperties(self):
778
1092
  """
779
- Tests that the `getPublicProperties` method of `ReflectionInstance` correctly identifies
780
- and returns only the public properties of a given class instance.
1093
+ Test ReflectionInstance.getPublicProperties() method functionality.
781
1094
 
782
- Verifies that:
783
- - Public properties (e.g., 'computed_public_property') are included in the result.
784
- - Protected (e.g., '_computed_property_protected') and private (e.g., '__computed_property_private')
785
- properties are not included in the result.
1095
+ Verifies that the getPublicProperties method correctly identifies and returns
1096
+ only public properties from the wrapped instance, excluding protected and
1097
+ private properties based on Python naming conventions.
1098
+
1099
+ Assertions
1100
+ ----------
1101
+ - 'computed_public_property' is included in the returned list
1102
+ - '_computed_property_protected' is not included in the returned list
1103
+ - '__computed_property_private' is not included in the returned list
786
1104
  """
787
1105
  reflect = ReflectionInstance(FakeClass())
788
1106
  public_properties = reflect.getPublicProperties()
@@ -792,12 +1110,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
792
1110
 
793
1111
  async def testGetProtectedProperties(self):
794
1112
  """
795
- Test that ReflectionInstance.getProtectedProperties() correctly identifies protected properties.
1113
+ Test ReflectionInstance.getProtectedProperties() method functionality.
1114
+
1115
+ Verifies that the getProtectedProperties method correctly identifies and returns
1116
+ only protected properties (prefixed with single underscore) from the wrapped
1117
+ instance, excluding public and private properties.
796
1118
 
797
- This test verifies that:
798
- - Protected properties (those prefixed with a single underscore) are included in the result.
799
- - Public properties are not included.
800
- - Private properties (those prefixed with double underscores) are not included.
1119
+ Assertions
1120
+ ----------
1121
+ - '_computed_property_protected' is included in the returned list
1122
+ - 'computed_public_property' is not included in the returned list
1123
+ - '__computed_property_private' is not included in the returned list
801
1124
  """
802
1125
  reflect = ReflectionInstance(FakeClass())
803
1126
  protected_properties = reflect.getProtectedProperties()
@@ -807,11 +1130,17 @@ class TestServiceReflectionInstance(AsyncTestCase):
807
1130
 
808
1131
  async def testGetPrivateProperties(self):
809
1132
  """
810
- Test that ReflectionInstance.getPrivateProperties() correctly identifies private properties.
1133
+ Test ReflectionInstance.getPrivateProperties() method functionality.
1134
+
1135
+ Verifies that the getPrivateProperties method correctly identifies and returns
1136
+ only private properties (prefixed with double underscores) from the wrapped
1137
+ instance, excluding public and protected properties.
811
1138
 
812
- This test verifies that:
813
- - Private properties (those with double underscores) are included in the result.
814
- - Public and protected properties are not included in the result.
1139
+ Assertions
1140
+ ----------
1141
+ - '__computed_property_private' is included in the returned list
1142
+ - 'computed_public_property' is not included in the returned list
1143
+ - '_computed_property_protected' is not included in the returned list
815
1144
  """
816
1145
  reflect = ReflectionInstance(FakeClass())
817
1146
  private_properties = reflect.getPrivateProperties()
@@ -821,11 +1150,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
821
1150
 
822
1151
  async def testGetProperty(self):
823
1152
  """
824
- Tests that the ReflectionInstance.getProperty method correctly retrieves the value of a computed public property
825
- from an instance of FakeClass.
1153
+ Test ReflectionInstance.getProperty() method functionality.
826
1154
 
827
- Asserts that the value returned by getProperty for 'computed_public_property' matches the actual property value
828
- from a new FakeClass instance.
1155
+ Verifies that the getProperty method correctly retrieves the value of a
1156
+ computed property from the wrapped instance. Tests property value access
1157
+ through reflection and compares with direct property access.
1158
+
1159
+ Assertions
1160
+ ----------
1161
+ - Property value retrieved through reflection equals direct property access value
829
1162
  """
830
1163
  reflect = ReflectionInstance(FakeClass())
831
1164
  value = reflect.getProperty('computed_public_property')
@@ -833,9 +1166,15 @@ class TestServiceReflectionInstance(AsyncTestCase):
833
1166
 
834
1167
  async def testGetPropertySignature(self):
835
1168
  """
836
- Tests that the `getPropertySignature` method of `ReflectionInstance` correctly retrieves
837
- the signature of the specified property ('computed_public_property') from a `FakeClass` instance.
838
- Asserts that the returned signature string matches the expected format '(self) -> str'.
1169
+ Test ReflectionInstance.getPropertySignature() method functionality.
1170
+
1171
+ Verifies that the getPropertySignature method correctly retrieves the
1172
+ signature of a specified property from the wrapped instance. Tests
1173
+ property signature inspection and string representation.
1174
+
1175
+ Assertions
1176
+ ----------
1177
+ - Signature of 'computed_public_property' equals '(self) -> str'
839
1178
  """
840
1179
  reflect = ReflectionInstance(FakeClass())
841
1180
  signature = reflect.getPropertySignature('computed_public_property')
@@ -843,20 +1182,31 @@ class TestServiceReflectionInstance(AsyncTestCase):
843
1182
 
844
1183
  async def testGetPropertyDocstring(self):
845
1184
  """
846
- Tests that the getPropertyDocstring method of ReflectionInstance correctly retrieves
847
- the docstring for the specified property ('computed_public_property') of the FakeClass instance.
848
- Asserts that the returned docstring contains the expected description.
1185
+ Test ReflectionInstance.getPropertyDocstring() method functionality.
1186
+
1187
+ Verifies that the getPropertyDocstring method correctly retrieves the
1188
+ docstring for a specified property from the wrapped instance. Tests
1189
+ property documentation extraction.
1190
+
1191
+ Assertions
1192
+ ----------
1193
+ - Docstring for 'computed_public_property' contains 'Returns a string indicating this is a public'
849
1194
  """
850
1195
  reflect = ReflectionInstance(FakeClass())
851
1196
  docstring = reflect.getPropertyDocstring('computed_public_property')
852
- self.assertIn('Returns the string "public" as', docstring)
1197
+ self.assertIn('Returns a string indicating this is a public', docstring)
853
1198
 
854
1199
  async def testGetConstructorDependencies(self):
855
1200
  """
856
- Tests that the `getConstructorDependencies` method of `ReflectionInstance` returns an instance of `ClassDependency`.
1201
+ Test ReflectionInstance.getConstructorDependencies() method functionality.
857
1202
 
858
- This test creates a `ReflectionInstance` for a `FakeClass` object, retrieves its constructor dependencies,
859
- and asserts that the returned value is an instance of `ClassDependency`.
1203
+ Verifies that the getConstructorDependencies method returns an instance
1204
+ of ClassDependency containing the constructor dependencies of the wrapped
1205
+ instance's class. Tests dependency analysis for class constructors.
1206
+
1207
+ Assertions
1208
+ ----------
1209
+ - Returned value is an instance of ClassDependency
860
1210
  """
861
1211
  reflect = ReflectionInstance(FakeClass())
862
1212
  dependencies = reflect.getConstructorDependencies()
@@ -864,14 +1214,18 @@ class TestServiceReflectionInstance(AsyncTestCase):
864
1214
 
865
1215
  async def testGetMethodDependencies(self):
866
1216
  """
867
- Test that the `getMethodDependencies` method of `ReflectionInstance` correctly resolves
868
- the dependencies of the 'instanceSyncMethod' in `FakeClass`.
1217
+ Test ReflectionInstance.getMethodDependencies() method functionality.
1218
+
1219
+ Verifies that the getMethodDependencies method correctly resolves the
1220
+ dependencies of a specified method from the wrapped instance. Tests
1221
+ method parameter type analysis and dependency resolution.
869
1222
 
870
- This test verifies that:
871
- - The method dependencies 'x' and 'y' are present in the resolved dependencies.
872
- - Both 'x' and 'y' are identified as integers (`int`), with the correct class name, module name,
873
- type, and full class path.
874
- - There are no unresolved dependencies.
1223
+ Assertions
1224
+ ----------
1225
+ - 'x' parameter is present in resolved dependencies
1226
+ - 'y' parameter is present in resolved dependencies
1227
+ - Both parameters are identified as int type with correct metadata
1228
+ - No unresolved dependencies exist
875
1229
  """
876
1230
  reflect = ReflectionInstance(FakeClass())
877
1231
  method_deps = reflect.getMethodDependencies('instanceSyncMethod')