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.
- orionis/container/context/scope.py +1 -1
- orionis/metadata/framework.py +1 -1
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/METADATA +1 -1
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/RECORD +23 -23
- tests/container/context/test_manager.py +1 -0
- tests/container/context/test_scope.py +1 -0
- tests/container/core/test_container.py +45 -1
- tests/container/core/test_singleton.py +5 -0
- tests/container/core/test_thread_safety.py +2 -0
- tests/container/validators/test_is_not_subclass.py +0 -1
- tests/foundation/config/queue/test_foundation_config_queue_brokers.py +1 -0
- tests/foundation/config/startup/test_foundation_config_startup.py +0 -1
- tests/services/environment/test_services_environment.py +5 -4
- tests/services/introspection/reflection/mock/fake_reflect_instance.py +750 -267
- tests/services/introspection/reflection/test_reflection_abstract.py +167 -92
- tests/services/introspection/reflection/test_reflection_callable.py +85 -35
- tests/services/introspection/reflection/test_reflection_concrete.py +345 -226
- tests/services/introspection/reflection/test_reflection_instance.py +627 -273
- tests/services/introspection/reflection/test_reflection_module.py +346 -175
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/WHEEL +0 -0
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/top_level.txt +0 -0
- {orionis-0.438.0.dist-info → orionis-0.439.0.dist-info}/zip-safe +0 -0
|
@@ -4,29 +4,6 @@ from tests.services.introspection.reflection.mock.fake_reflect_instance import A
|
|
|
4
4
|
from orionis.test.cases.asynchronous import AsyncTestCase
|
|
5
5
|
|
|
6
6
|
class TestServiceReflectionAbstract(AsyncTestCase):
|
|
7
|
-
"""
|
|
8
|
-
Test suite for the ReflectionAbstract class functionality.
|
|
9
|
-
|
|
10
|
-
This test class provides comprehensive testing for the ReflectionAbstract
|
|
11
|
-
service, which offers introspection capabilities for Python classes including
|
|
12
|
-
attribute inspection, method discovery, dependency analysis, and metadata extraction.
|
|
13
|
-
|
|
14
|
-
The tests verify that the reflection service correctly handles:
|
|
15
|
-
- Class metadata retrieval (name, module, docstring, etc.)
|
|
16
|
-
- Attribute management and visibility filtering
|
|
17
|
-
- Method discovery and categorization (public/protected/private, sync/async)
|
|
18
|
-
- Property introspection
|
|
19
|
-
- Dependency analysis for constructors and methods
|
|
20
|
-
- Source code and file information access
|
|
21
|
-
|
|
22
|
-
Test Target
|
|
23
|
-
-----------
|
|
24
|
-
orionis.services.introspection.abstract.reflection.ReflectionAbstract
|
|
25
|
-
|
|
26
|
-
Mock Objects
|
|
27
|
-
------------
|
|
28
|
-
AbstractFakeClass : Mock class for testing reflection capabilities
|
|
29
|
-
"""
|
|
30
7
|
|
|
31
8
|
async def testGetClass(self):
|
|
32
9
|
"""
|
|
@@ -345,58 +322,6 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
345
322
|
self.assertTrue(reflect.hasMethod('instanceSyncMethod'))
|
|
346
323
|
self.assertFalse(reflect.hasMethod('non_existent_method'))
|
|
347
324
|
|
|
348
|
-
async def testCallMethod(self):
|
|
349
|
-
"""
|
|
350
|
-
Test the callMethod method of ReflectionAbstract.
|
|
351
|
-
|
|
352
|
-
This test method is not applicable for ReflectionAbstract as it only
|
|
353
|
-
provides introspection capabilities without method execution.
|
|
354
|
-
|
|
355
|
-
Notes
|
|
356
|
-
-----
|
|
357
|
-
ReflectionAbstract is designed for reflection, not execution.
|
|
358
|
-
"""
|
|
359
|
-
# No aplica para ReflectionAbstract, se omite
|
|
360
|
-
|
|
361
|
-
async def testCallAsyncMethod(self):
|
|
362
|
-
"""
|
|
363
|
-
Test the callAsyncMethod method of ReflectionAbstract.
|
|
364
|
-
|
|
365
|
-
This test method is not applicable for ReflectionAbstract as it only
|
|
366
|
-
provides introspection capabilities without method execution.
|
|
367
|
-
|
|
368
|
-
Notes
|
|
369
|
-
-----
|
|
370
|
-
ReflectionAbstract is designed for reflection, not execution.
|
|
371
|
-
"""
|
|
372
|
-
# No aplica para ReflectionAbstract, se omite
|
|
373
|
-
|
|
374
|
-
async def testSetMethod(self):
|
|
375
|
-
"""
|
|
376
|
-
Test the setMethod method of ReflectionAbstract.
|
|
377
|
-
|
|
378
|
-
This test method is not applicable for ReflectionAbstract as it only
|
|
379
|
-
provides introspection capabilities without method modification.
|
|
380
|
-
|
|
381
|
-
Notes
|
|
382
|
-
-----
|
|
383
|
-
ReflectionAbstract is designed for reflection, not modification.
|
|
384
|
-
"""
|
|
385
|
-
# No aplica para ReflectionAbstract, se omite
|
|
386
|
-
|
|
387
|
-
async def testRemoveMethod(self):
|
|
388
|
-
"""
|
|
389
|
-
Test the removeMethod method of ReflectionAbstract.
|
|
390
|
-
|
|
391
|
-
This test method is not applicable for ReflectionAbstract as it only
|
|
392
|
-
provides introspection capabilities without method removal.
|
|
393
|
-
|
|
394
|
-
Notes
|
|
395
|
-
-----
|
|
396
|
-
ReflectionAbstract is designed for reflection, not modification.
|
|
397
|
-
"""
|
|
398
|
-
# No aplica para ReflectionAbstract, se omite
|
|
399
|
-
|
|
400
325
|
async def testGetMethodSignature(self):
|
|
401
326
|
"""
|
|
402
327
|
Test the getMethodSignature method of ReflectionAbstract.
|
|
@@ -617,7 +542,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
617
542
|
|
|
618
543
|
async def testGetPublicClassAsyncMethods(self):
|
|
619
544
|
"""
|
|
620
|
-
|
|
545
|
+
Test getPublicClassAsyncMethods for public class async methods.
|
|
546
|
+
|
|
547
|
+
Returns
|
|
548
|
+
-------
|
|
549
|
+
None
|
|
550
|
+
|
|
551
|
+
Notes
|
|
552
|
+
-----
|
|
553
|
+
Ensures that only public class asynchronous methods are returned by
|
|
554
|
+
getPublicClassAsyncMethods. Public methods have no leading underscores.
|
|
621
555
|
"""
|
|
622
556
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
623
557
|
public_class_async_methods = reflect.getPublicClassAsyncMethods()
|
|
@@ -627,7 +561,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
627
561
|
|
|
628
562
|
async def testGetProtectedClassMethods(self):
|
|
629
563
|
"""
|
|
630
|
-
|
|
564
|
+
Test getProtectedClassMethods for protected class methods.
|
|
565
|
+
|
|
566
|
+
Returns
|
|
567
|
+
-------
|
|
568
|
+
None
|
|
569
|
+
|
|
570
|
+
Notes
|
|
571
|
+
-----
|
|
572
|
+
Ensures that only protected class methods (single leading underscore)
|
|
573
|
+
are returned by getProtectedClassMethods.
|
|
631
574
|
"""
|
|
632
575
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
633
576
|
protected_class_methods = reflect.getProtectedClassMethods()
|
|
@@ -637,7 +580,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
637
580
|
|
|
638
581
|
async def testGetProtectedClassSyncMethods(self):
|
|
639
582
|
"""
|
|
640
|
-
|
|
583
|
+
Test getProtectedClassSyncMethods for protected class sync methods.
|
|
584
|
+
|
|
585
|
+
Returns
|
|
586
|
+
-------
|
|
587
|
+
None
|
|
588
|
+
|
|
589
|
+
Notes
|
|
590
|
+
-----
|
|
591
|
+
Ensures that only protected synchronous class methods (single leading underscore)
|
|
592
|
+
are returned by getProtectedClassSyncMethods.
|
|
641
593
|
"""
|
|
642
594
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
643
595
|
protected_class_sync_methods = reflect.getProtectedClassSyncMethods()
|
|
@@ -647,7 +599,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
647
599
|
|
|
648
600
|
async def testGetProtectedClassAsyncMethods(self):
|
|
649
601
|
"""
|
|
650
|
-
|
|
602
|
+
Test that getProtectedClassAsyncMethods returns only protected class asynchronous methods.
|
|
603
|
+
|
|
604
|
+
Returns
|
|
605
|
+
-------
|
|
606
|
+
None
|
|
607
|
+
|
|
608
|
+
Notes
|
|
609
|
+
-----
|
|
610
|
+
Ensures that only protected class async methods (single leading underscore)
|
|
611
|
+
are included in the result, while public and private class async methods are excluded.
|
|
651
612
|
"""
|
|
652
613
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
653
614
|
protected_class_async_methods = reflect.getProtectedClassAsyncMethods()
|
|
@@ -657,7 +618,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
657
618
|
|
|
658
619
|
async def testGetPrivateClassMethods(self):
|
|
659
620
|
"""
|
|
660
|
-
|
|
621
|
+
Test that getPrivateClassMethods returns only private class methods.
|
|
622
|
+
|
|
623
|
+
Returns
|
|
624
|
+
-------
|
|
625
|
+
None
|
|
626
|
+
|
|
627
|
+
Notes
|
|
628
|
+
-----
|
|
629
|
+
Ensures that only private class methods (double leading underscore)
|
|
630
|
+
are included in the result, while public and protected class methods are excluded.
|
|
661
631
|
"""
|
|
662
632
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
663
633
|
private_class_methods = reflect.getPrivateClassMethods()
|
|
@@ -667,7 +637,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
667
637
|
|
|
668
638
|
async def testGetPrivateClassSyncMethods(self):
|
|
669
639
|
"""
|
|
670
|
-
|
|
640
|
+
Test that getPrivateClassSyncMethods returns only private synchronous class methods.
|
|
641
|
+
|
|
642
|
+
Returns
|
|
643
|
+
-------
|
|
644
|
+
None
|
|
645
|
+
|
|
646
|
+
Notes
|
|
647
|
+
-----
|
|
648
|
+
Ensures that only private synchronous class methods (double leading underscore)
|
|
649
|
+
are included in the result, while public and protected class sync methods are excluded.
|
|
671
650
|
"""
|
|
672
651
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
673
652
|
private_class_methods = reflect.getPrivateClassSyncMethods()
|
|
@@ -677,7 +656,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
677
656
|
|
|
678
657
|
async def testGetPrivateClassAsyncMethods(self):
|
|
679
658
|
"""
|
|
680
|
-
|
|
659
|
+
Test that getPrivateClassAsyncMethods returns only private class asynchronous methods.
|
|
660
|
+
|
|
661
|
+
Returns
|
|
662
|
+
-------
|
|
663
|
+
None
|
|
664
|
+
|
|
665
|
+
Notes
|
|
666
|
+
-----
|
|
667
|
+
Ensures that only private class async methods (double leading underscore)
|
|
668
|
+
are included in the result, while public and protected class async methods are excluded.
|
|
681
669
|
"""
|
|
682
670
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
683
671
|
private_class_async_methods = reflect.getPrivateClassAsyncMethods()
|
|
@@ -687,7 +675,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
687
675
|
|
|
688
676
|
async def testGetPublicStaticMethods(self):
|
|
689
677
|
"""
|
|
690
|
-
|
|
678
|
+
Test that getPublicStaticMethods returns only public static methods.
|
|
679
|
+
|
|
680
|
+
Returns
|
|
681
|
+
-------
|
|
682
|
+
None
|
|
683
|
+
|
|
684
|
+
Notes
|
|
685
|
+
-----
|
|
686
|
+
Ensures that only public static methods (no leading underscore) are included in the result.
|
|
687
|
+
Both synchronous and asynchronous public static methods are considered.
|
|
691
688
|
"""
|
|
692
689
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
693
690
|
public_static_methods = reflect.getPublicStaticMethods()
|
|
@@ -697,7 +694,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
697
694
|
|
|
698
695
|
async def testGetPublicStaticSyncMethods(self):
|
|
699
696
|
"""
|
|
700
|
-
|
|
697
|
+
Test that getPublicStaticSyncMethods returns only public static synchronous methods.
|
|
698
|
+
|
|
699
|
+
Returns
|
|
700
|
+
-------
|
|
701
|
+
None
|
|
702
|
+
|
|
703
|
+
Notes
|
|
704
|
+
-----
|
|
705
|
+
Ensures that only public static synchronous methods (no leading underscore)
|
|
706
|
+
are included in the result, while async and non-public static methods are excluded.
|
|
701
707
|
"""
|
|
702
708
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
703
709
|
public_static_sync_methods = reflect.getPublicStaticSyncMethods()
|
|
@@ -707,7 +713,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
707
713
|
|
|
708
714
|
async def testGetPublicStaticAsyncMethods(self):
|
|
709
715
|
"""
|
|
710
|
-
|
|
716
|
+
Test that getPublicStaticAsyncMethods returns only public static asynchronous methods.
|
|
717
|
+
|
|
718
|
+
Returns
|
|
719
|
+
-------
|
|
720
|
+
None
|
|
721
|
+
|
|
722
|
+
Notes
|
|
723
|
+
-----
|
|
724
|
+
Ensures that only public static asynchronous methods (no leading underscore)
|
|
725
|
+
are included in the result, while synchronous and non-public static methods are excluded.
|
|
711
726
|
"""
|
|
712
727
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
713
728
|
public_static_async_methods = reflect.getPublicStaticAsyncMethods()
|
|
@@ -717,7 +732,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
717
732
|
|
|
718
733
|
async def testGetProtectedStaticMethods(self):
|
|
719
734
|
"""
|
|
720
|
-
|
|
735
|
+
Test that getProtectedStaticMethods returns only protected static methods.
|
|
736
|
+
|
|
737
|
+
Returns
|
|
738
|
+
-------
|
|
739
|
+
None
|
|
740
|
+
|
|
741
|
+
Notes
|
|
742
|
+
-----
|
|
743
|
+
Ensures that only protected static methods (single leading underscore)
|
|
744
|
+
are included in the result, while public and private static methods are excluded.
|
|
721
745
|
"""
|
|
722
746
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
723
747
|
protected_static_methods = reflect.getProtectedStaticMethods()
|
|
@@ -727,7 +751,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
727
751
|
|
|
728
752
|
async def testGetProtectedStaticSyncMethods(self):
|
|
729
753
|
"""
|
|
730
|
-
|
|
754
|
+
Test that getProtectedStaticSyncMethods returns only protected static synchronous methods.
|
|
755
|
+
|
|
756
|
+
Returns
|
|
757
|
+
-------
|
|
758
|
+
None
|
|
759
|
+
|
|
760
|
+
Notes
|
|
761
|
+
-----
|
|
762
|
+
Ensures that only protected static synchronous methods (single leading underscore)
|
|
763
|
+
are included in the result, while async, public, and private static methods are excluded.
|
|
731
764
|
"""
|
|
732
765
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
733
766
|
protected_static_sync_methods = reflect.getProtectedStaticSyncMethods()
|
|
@@ -737,7 +770,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
737
770
|
|
|
738
771
|
async def testGetProtectedStaticAsyncMethods(self):
|
|
739
772
|
"""
|
|
740
|
-
|
|
773
|
+
Test that getProtectedStaticAsyncMethods returns only protected static asynchronous methods.
|
|
774
|
+
|
|
775
|
+
Returns
|
|
776
|
+
-------
|
|
777
|
+
None
|
|
778
|
+
|
|
779
|
+
Notes
|
|
780
|
+
-----
|
|
781
|
+
Ensures that only protected static asynchronous methods (single leading underscore)
|
|
782
|
+
are included in the result, while public and private static methods are excluded.
|
|
741
783
|
"""
|
|
742
784
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
743
785
|
protected_static_async_methods = reflect.getProtectedStaticAsyncMethods()
|
|
@@ -747,7 +789,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
747
789
|
|
|
748
790
|
async def testGetPrivateStaticMethods(self):
|
|
749
791
|
"""
|
|
750
|
-
|
|
792
|
+
Test that getPrivateStaticMethods returns only private static methods.
|
|
793
|
+
|
|
794
|
+
Returns
|
|
795
|
+
-------
|
|
796
|
+
None
|
|
797
|
+
|
|
798
|
+
Notes
|
|
799
|
+
-----
|
|
800
|
+
Ensures that only private static methods (double leading underscore)
|
|
801
|
+
are included in the result, while public and protected static methods are excluded.
|
|
751
802
|
"""
|
|
752
803
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
753
804
|
private_static_methods = reflect.getPrivateStaticMethods()
|
|
@@ -757,7 +808,16 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
757
808
|
|
|
758
809
|
async def testGetPrivateStaticSyncMethods(self):
|
|
759
810
|
"""
|
|
760
|
-
|
|
811
|
+
Test that getPrivateStaticSyncMethods returns only private static synchronous methods.
|
|
812
|
+
|
|
813
|
+
Returns
|
|
814
|
+
-------
|
|
815
|
+
None
|
|
816
|
+
|
|
817
|
+
Notes
|
|
818
|
+
-----
|
|
819
|
+
Ensures that only private static synchronous methods (double leading underscore)
|
|
820
|
+
are included in the result, while public and protected static sync methods are excluded.
|
|
761
821
|
"""
|
|
762
822
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
763
823
|
private_static_sync_methods = reflect.getPrivateStaticSyncMethods()
|
|
@@ -767,10 +827,25 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
767
827
|
|
|
768
828
|
async def testGetPrivateStaticAsyncMethods(self):
|
|
769
829
|
"""
|
|
770
|
-
|
|
830
|
+
Test that getPrivateStaticAsyncMethods returns only private static asynchronous methods.
|
|
831
|
+
|
|
832
|
+
Parameters
|
|
833
|
+
----------
|
|
834
|
+
self : TestServiceReflectionAbstract
|
|
835
|
+
The test case instance.
|
|
836
|
+
|
|
837
|
+
Returns
|
|
838
|
+
-------
|
|
839
|
+
None
|
|
840
|
+
|
|
841
|
+
Notes
|
|
842
|
+
-----
|
|
843
|
+
Ensures that only private static asynchronous methods (double leading underscore)
|
|
844
|
+
are included in the result, while public and protected static async methods are excluded.
|
|
771
845
|
"""
|
|
772
846
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
773
847
|
private_static_async_methods = reflect.getPrivateStaticAsyncMethods()
|
|
848
|
+
# Should include only double underscore (private) static async methods
|
|
774
849
|
self.assertIn('__staticAsyncMethodPrivate', private_static_async_methods)
|
|
775
850
|
self.assertNotIn('staticAsyncMethod', private_static_async_methods)
|
|
776
851
|
self.assertNotIn('_staticAsyncMethodProtected', private_static_async_methods)
|
|
@@ -901,7 +976,7 @@ class TestServiceReflectionAbstract(AsyncTestCase):
|
|
|
901
976
|
"""
|
|
902
977
|
reflect = ReflectionAbstract(AbstractFakeClass)
|
|
903
978
|
docstring = reflect.getPropertyDocstring('computed_public_property')
|
|
904
|
-
self.assertIn('
|
|
979
|
+
self.assertIn('Abstract property for a computed', docstring)
|
|
905
980
|
|
|
906
981
|
async def testGetConstructorDependencies(self):
|
|
907
982
|
"""
|
|
@@ -7,8 +7,14 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
7
7
|
|
|
8
8
|
async def testInitValidFunction(self):
|
|
9
9
|
"""
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Test initialization of ReflectionCallable with a valid function.
|
|
11
|
+
|
|
12
|
+
Validates that a ReflectionCallable instance can be created with a standard function
|
|
13
|
+
and that the stored callable matches the original function.
|
|
14
|
+
|
|
15
|
+
Returns
|
|
16
|
+
-------
|
|
17
|
+
None
|
|
12
18
|
"""
|
|
13
19
|
def sample_function(a, b=2):
|
|
14
20
|
"""Sample docstring."""
|
|
@@ -18,18 +24,27 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
18
24
|
|
|
19
25
|
async def testInitInvalid(self):
|
|
20
26
|
"""
|
|
21
|
-
Test
|
|
27
|
+
Test initialization of ReflectionCallable with an invalid argument.
|
|
28
|
+
|
|
29
|
+
Ensures that passing a non-callable object (e.g., an integer) to ReflectionCallable
|
|
22
30
|
raises a ReflectionTypeError.
|
|
31
|
+
|
|
32
|
+
Returns
|
|
33
|
+
-------
|
|
34
|
+
None
|
|
23
35
|
"""
|
|
24
36
|
with self.assertRaises(ReflectionTypeError):
|
|
25
37
|
ReflectionCallable(123)
|
|
26
38
|
|
|
27
39
|
async def testGetName(self):
|
|
28
40
|
"""
|
|
29
|
-
|
|
41
|
+
Test retrieval of the function name from ReflectionCallable.
|
|
42
|
+
|
|
43
|
+
Checks that the getName() method returns the correct name of the wrapped function.
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
None
|
|
33
48
|
"""
|
|
34
49
|
def sample_function(a, b=2):
|
|
35
50
|
"""Sample docstring."""
|
|
@@ -39,9 +54,13 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
39
54
|
|
|
40
55
|
async def testGetModuleName(self):
|
|
41
56
|
"""
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
Test retrieval of the module name from ReflectionCallable.
|
|
58
|
+
|
|
59
|
+
Verifies that getModuleName() returns the module name where the function is defined.
|
|
60
|
+
|
|
61
|
+
Returns
|
|
62
|
+
-------
|
|
63
|
+
None
|
|
45
64
|
"""
|
|
46
65
|
def sample_function(a, b=2):
|
|
47
66
|
"""Sample docstring."""
|
|
@@ -51,12 +70,14 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
51
70
|
|
|
52
71
|
async def testGetModuleWithCallableName(self):
|
|
53
72
|
"""
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
and function name
|
|
73
|
+
Test retrieval of the fully qualified name from ReflectionCallable.
|
|
74
|
+
|
|
75
|
+
Ensures that getModuleWithCallableName() returns the module and function name
|
|
76
|
+
in the format "<module>.<function_name>".
|
|
57
77
|
|
|
58
|
-
|
|
59
|
-
|
|
78
|
+
Returns
|
|
79
|
+
-------
|
|
80
|
+
None
|
|
60
81
|
"""
|
|
61
82
|
def sample_function(a, b=2):
|
|
62
83
|
"""Sample docstring."""
|
|
@@ -67,7 +88,13 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
67
88
|
|
|
68
89
|
async def testGetDocstring(self):
|
|
69
90
|
"""
|
|
70
|
-
|
|
91
|
+
Test retrieval of the docstring from ReflectionCallable.
|
|
92
|
+
|
|
93
|
+
Confirms that getDocstring() returns the docstring of the wrapped function.
|
|
94
|
+
|
|
95
|
+
Returns
|
|
96
|
+
-------
|
|
97
|
+
None
|
|
71
98
|
"""
|
|
72
99
|
def sample_function(a, b=2):
|
|
73
100
|
"""Sample docstring."""
|
|
@@ -77,9 +104,14 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
77
104
|
|
|
78
105
|
async def testGetSourceCode(self):
|
|
79
106
|
"""
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
the
|
|
107
|
+
Test retrieval of source code from ReflectionCallable.
|
|
108
|
+
|
|
109
|
+
Checks that getSourceCode() returns the source code of the wrapped function,
|
|
110
|
+
and that the code contains the function definition.
|
|
111
|
+
|
|
112
|
+
Returns
|
|
113
|
+
-------
|
|
114
|
+
None
|
|
83
115
|
"""
|
|
84
116
|
def sample_function(a, b=2):
|
|
85
117
|
"""Sample docstring."""
|
|
@@ -90,8 +122,14 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
90
122
|
|
|
91
123
|
async def testGetSourceCodeError(self):
|
|
92
124
|
"""
|
|
93
|
-
Test
|
|
94
|
-
|
|
125
|
+
Test error handling when retrieving source code from a built-in function.
|
|
126
|
+
|
|
127
|
+
Ensures that getSourceCode() raises a ReflectionTypeError when called on a
|
|
128
|
+
built-in function (e.g., len) that lacks accessible source code.
|
|
129
|
+
|
|
130
|
+
Returns
|
|
131
|
+
-------
|
|
132
|
+
None
|
|
95
133
|
"""
|
|
96
134
|
with self.assertRaises(ReflectionTypeError):
|
|
97
135
|
rc = ReflectionCallable(len)
|
|
@@ -99,9 +137,14 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
99
137
|
|
|
100
138
|
async def testGetFile(self):
|
|
101
139
|
"""
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
140
|
+
Test retrieval of the file path from ReflectionCallable.
|
|
141
|
+
|
|
142
|
+
Verifies that getFile() returns the file path of the wrapped function and that
|
|
143
|
+
the path ends with '.py', indicating a Python source file.
|
|
144
|
+
|
|
145
|
+
Returns
|
|
146
|
+
-------
|
|
147
|
+
None
|
|
105
148
|
"""
|
|
106
149
|
def sample_function(a, b=2):
|
|
107
150
|
"""Sample docstring."""
|
|
@@ -112,11 +155,13 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
112
155
|
|
|
113
156
|
async def testCallSync(self):
|
|
114
157
|
"""
|
|
115
|
-
|
|
158
|
+
Test synchronous invocation of the wrapped function using ReflectionCallable.
|
|
159
|
+
|
|
160
|
+
Validates that calling the wrapped function with arguments returns the expected result.
|
|
116
161
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
162
|
+
Returns
|
|
163
|
+
-------
|
|
164
|
+
None
|
|
120
165
|
"""
|
|
121
166
|
def sample_function(a, b=2):
|
|
122
167
|
"""Sample docstring."""
|
|
@@ -126,10 +171,13 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
126
171
|
|
|
127
172
|
async def testCallAsync(self):
|
|
128
173
|
"""
|
|
129
|
-
|
|
174
|
+
Test asynchronous invocation of an async function using ReflectionCallable.
|
|
130
175
|
|
|
131
|
-
|
|
132
|
-
|
|
176
|
+
Ensures that an asynchronous function can be called and awaited, returning the correct result.
|
|
177
|
+
|
|
178
|
+
Returns
|
|
179
|
+
-------
|
|
180
|
+
None
|
|
133
181
|
"""
|
|
134
182
|
async def sample_async_function(a, b=2):
|
|
135
183
|
"""Async docstring."""
|
|
@@ -139,12 +187,14 @@ class TestReflectionCallable(AsyncTestCase):
|
|
|
139
187
|
|
|
140
188
|
async def testGetDependencies(self):
|
|
141
189
|
"""
|
|
142
|
-
|
|
190
|
+
Test retrieval of callable dependencies from ReflectionCallable.
|
|
191
|
+
|
|
192
|
+
Checks that getDependencies() returns a CallableDependency object with
|
|
193
|
+
'resolved' and 'unresolved' attributes for the wrapped function.
|
|
143
194
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
'unresolved' attributes.
|
|
195
|
+
Returns
|
|
196
|
+
-------
|
|
197
|
+
None
|
|
148
198
|
"""
|
|
149
199
|
def sample_function(a, b=2):
|
|
150
200
|
"""Sample docstring."""
|