orionis 0.200.0__py3-none-any.whl → 0.202.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/framework.py +1 -1
- orionis/luminate/container/container_integrity.py +56 -1
- orionis/luminate/facades/tests/tests_facade.py +1 -1
- orionis/luminate/support/inspection/container_integrity.py +292 -0
- orionis/luminate/support/inspection/functions.py +235 -0
- orionis/luminate/support/inspection/reflection.py +649 -0
- orionis/luminate/support/inspection/reflexion_abstract.py +23 -0
- orionis/luminate/support/inspection/reflexion_concrete.py +24 -0
- orionis/luminate/support/inspection/reflexion_concrete_with_abstract.py +31 -0
- orionis/luminate/support/inspection/reflexion_instance.py +364 -0
- orionis/luminate/support/inspection/reflexion_instance_with_abstract.py +309 -0
- orionis/luminate/support/inspection/reflexion_module.py +19 -0
- orionis/luminate/support/inspection/reflexion_module_with_classname.py +22 -0
- orionis/luminate/test/{exception.py → test_exception.py} +1 -2
- orionis/luminate/test/test_result.py +30 -0
- orionis/luminate/test/test_status.py +22 -0
- orionis/luminate/test/tests.py +67 -0
- orionis/luminate/test/unit_test.py +276 -56
- {orionis-0.200.0.dist-info → orionis-0.202.0.dist-info}/METADATA +1 -1
- {orionis-0.200.0.dist-info → orionis-0.202.0.dist-info}/RECORD +26 -14
- tests/main.py +0 -0
- tests/tools/class_example.py +0 -50
- tests/tools/test_reflection.py +0 -128
- {tests/tools → orionis/luminate/support/inspection}/__init__.py +0 -0
- {orionis-0.200.0.dist-info → orionis-0.202.0.dist-info}/LICENCE +0 -0
- {orionis-0.200.0.dist-info → orionis-0.202.0.dist-info}/WHEEL +0 -0
- {orionis-0.200.0.dist-info → orionis-0.202.0.dist-info}/entry_points.txt +0 -0
- {orionis-0.200.0.dist-info → orionis-0.202.0.dist-info}/top_level.txt +0 -0
tests/tools/class_example.py
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
from enum import Enum
|
2
|
-
|
3
|
-
class BaseTestClass:
|
4
|
-
"""
|
5
|
-
This is a sample base class for testing reflection.
|
6
|
-
It includes methods, properties, and a constant.
|
7
|
-
"""
|
8
|
-
|
9
|
-
CONSTANT = "This is a constant"
|
10
|
-
|
11
|
-
def __init__(self, value: int):
|
12
|
-
self.value = value
|
13
|
-
|
14
|
-
@property
|
15
|
-
def squared(self):
|
16
|
-
return self.value ** 2
|
17
|
-
|
18
|
-
def method(self):
|
19
|
-
return "This is a method"
|
20
|
-
|
21
|
-
@classmethod
|
22
|
-
def class_method(cls):
|
23
|
-
return "This is a class method"
|
24
|
-
|
25
|
-
class TestClass(BaseTestClass):
|
26
|
-
"""
|
27
|
-
This is a sample class for testing reflection.
|
28
|
-
It includes methods, properties, and a constant.
|
29
|
-
"""
|
30
|
-
|
31
|
-
CONSTANT = "This is a constant"
|
32
|
-
|
33
|
-
def __init__(self, value: int):
|
34
|
-
self.value = value
|
35
|
-
|
36
|
-
@property
|
37
|
-
def squared(self):
|
38
|
-
return self.value ** 2
|
39
|
-
|
40
|
-
def method(self):
|
41
|
-
return "This is a method"
|
42
|
-
|
43
|
-
@classmethod
|
44
|
-
def class_method(cls):
|
45
|
-
return "This is a class method"
|
46
|
-
|
47
|
-
class TestEnum(Enum):
|
48
|
-
RED = 1
|
49
|
-
GREEN = 2
|
50
|
-
BLUE = 3
|
tests/tools/test_reflection.py
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import unittest
|
3
|
-
from orionis.luminate.support.reflection import Reflection
|
4
|
-
from tests.tools.class_example import BaseTestClass, TestClass, TestEnum
|
5
|
-
|
6
|
-
class TestReflection(unittest.TestCase):
|
7
|
-
|
8
|
-
def setUp(self):
|
9
|
-
"""Set up the test case."""
|
10
|
-
self.reflection = Reflection(TestClass)
|
11
|
-
|
12
|
-
def test_get_file(self):
|
13
|
-
"""Test if the file path is correctly retrieved."""
|
14
|
-
path = self.reflection.getFile().split(os.sep)
|
15
|
-
self.assertEqual(path[-1], "class_example.py")
|
16
|
-
|
17
|
-
def test_has_class(self):
|
18
|
-
"""Test if the class is loaded."""
|
19
|
-
self.assertTrue(self.reflection.hasClass())
|
20
|
-
|
21
|
-
def test_has_method(self):
|
22
|
-
"""Test if the class has specific methods."""
|
23
|
-
self.assertTrue(self.reflection.hasMethod("method"))
|
24
|
-
self.assertFalse(self.reflection.hasMethod("non_existent_method"))
|
25
|
-
|
26
|
-
def test_has_property(self):
|
27
|
-
"""Test if the class has specific properties."""
|
28
|
-
self.assertTrue(self.reflection.hasProperty("squared"))
|
29
|
-
self.assertFalse(self.reflection.hasProperty("non_existent_property"))
|
30
|
-
|
31
|
-
def test_has_constant(self):
|
32
|
-
"""Test if the class has specific constants."""
|
33
|
-
self.assertTrue(self.reflection.hasConstant("CONSTANT"))
|
34
|
-
self.assertFalse(self.reflection.hasConstant("NON_EXISTENT_CONSTANT"))
|
35
|
-
|
36
|
-
def test_get_attributes(self):
|
37
|
-
"""Test if the class attributes (methods, properties) are retrieved."""
|
38
|
-
attributes = self.reflection.getAttributes()
|
39
|
-
self.assertIn("method", attributes)
|
40
|
-
self.assertIn("squared", attributes)
|
41
|
-
|
42
|
-
def test_get_constructor(self):
|
43
|
-
"""Test if the constructor is correctly retrieved."""
|
44
|
-
constructor = self.reflection.getConstructor()
|
45
|
-
self.assertEqual(constructor.__name__, "__init__")
|
46
|
-
|
47
|
-
def test_get_docstring(self):
|
48
|
-
"""Test if the docstring is correctly retrieved."""
|
49
|
-
doc = self.reflection.getDocComment()
|
50
|
-
self.assertIn("sample class for testing reflection", doc)
|
51
|
-
|
52
|
-
def test_get_file_name(self):
|
53
|
-
"""Test if the file name where the class is defined is retrieved."""
|
54
|
-
file_name = self.reflection.getFileName(remove_extension=True)
|
55
|
-
self.assertEqual(file_name, "class_example")
|
56
|
-
|
57
|
-
def test_get_method(self):
|
58
|
-
"""Test if a specific method is correctly retrieved."""
|
59
|
-
method = self.reflection.getMethod("method")
|
60
|
-
self.assertIsNotNone(method)
|
61
|
-
|
62
|
-
def test_get_methods(self):
|
63
|
-
"""Test if all methods are correctly retrieved."""
|
64
|
-
methods = self.reflection.getMethods()
|
65
|
-
self.assertGreater(len(methods), 0)
|
66
|
-
|
67
|
-
def test_get_name(self):
|
68
|
-
"""Test if the class name is correctly retrieved."""
|
69
|
-
name = self.reflection.getName()
|
70
|
-
self.assertEqual(name, "TestClass")
|
71
|
-
|
72
|
-
def test_get_parent_class(self):
|
73
|
-
"""Test if the parent classes are correctly retrieved."""
|
74
|
-
parent = self.reflection.getParentClass()
|
75
|
-
self.assertTrue(self.reflection.isSubclassOf(BaseTestClass))
|
76
|
-
|
77
|
-
def test_get_properties(self):
|
78
|
-
"""Test if the class properties are correctly retrieved."""
|
79
|
-
properties = self.reflection.getProperties()
|
80
|
-
self.assertIn("squared", properties)
|
81
|
-
|
82
|
-
def test_get_property(self):
|
83
|
-
"""Test if a specific property is correctly retrieved."""
|
84
|
-
property_value = self.reflection.getProperty("squared")
|
85
|
-
self.assertIsNotNone(property_value)
|
86
|
-
|
87
|
-
def test_is_abstract(self):
|
88
|
-
"""Test if the class is abstract."""
|
89
|
-
self.assertFalse(self.reflection.isAbstract())
|
90
|
-
|
91
|
-
def test_is_enum(self):
|
92
|
-
"""Test if the class is an enum."""
|
93
|
-
enum_reflection = Reflection(TestEnum)
|
94
|
-
self.assertTrue(enum_reflection.isEnum())
|
95
|
-
|
96
|
-
def test_is_subclass_of(self):
|
97
|
-
"""Test if the class is a subclass of the specified parent."""
|
98
|
-
self.assertTrue(self.reflection.isSubclassOf(BaseTestClass))
|
99
|
-
|
100
|
-
def test_is_instance_of(self):
|
101
|
-
"""Test if the class is an instance of the specified class."""
|
102
|
-
instance = TestClass(5)
|
103
|
-
self.assertTrue(self.reflection.isInstanceOf(instance))
|
104
|
-
|
105
|
-
def test_is_iterable(self):
|
106
|
-
"""Test if the class is iterable."""
|
107
|
-
self.assertFalse(self.reflection.isIterable())
|
108
|
-
|
109
|
-
def test_is_instantiable(self):
|
110
|
-
"""Test if the class is instantiable."""
|
111
|
-
self.assertTrue(self.reflection.isInstantiable())
|
112
|
-
|
113
|
-
def test_new_instance(self):
|
114
|
-
"""Test if a new instance of the class can be created."""
|
115
|
-
instance = self.reflection.newInstance(5)
|
116
|
-
self.assertEqual(instance.value, 5)
|
117
|
-
|
118
|
-
def test_class_method_and_property(self):
|
119
|
-
"""Test if class methods and properties work for an instance."""
|
120
|
-
instance = self.reflection.newInstance(5)
|
121
|
-
self.assertEqual(instance.class_method(), "This is a class method")
|
122
|
-
self.assertEqual(instance.squared, 25)
|
123
|
-
|
124
|
-
def test_str_representation(self):
|
125
|
-
"""Test the string representation of the reflection instance."""
|
126
|
-
str_rep = str(self.reflection)
|
127
|
-
self.assertIn("Orionis Reflection class", str_rep)
|
128
|
-
self.assertIn("TestClass", str_rep)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|