orionis 0.282.0__py3-none-any.whl → 0.284.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 (48) hide show
  1. orionis/application.py +2 -7
  2. orionis/foundation/config/testing/entities/testing.py +25 -0
  3. orionis/metadata/framework.py +1 -1
  4. orionis/services/asynchrony/{async_io.py → coroutines.py} +2 -1
  5. orionis/services/asynchrony/exceptions/__init__.py +0 -0
  6. orionis/services/asynchrony/exceptions/coroutine_exception.py +26 -0
  7. orionis/services/environment/dot_env.py +44 -14
  8. orionis/services/environment/env.py +60 -12
  9. orionis/services/environment/exceptions/__init__.py +0 -0
  10. orionis/services/environment/exceptions/value_exception.py +27 -0
  11. orionis/services/introspection/exceptions/__init__.py +0 -0
  12. orionis/services/introspection/exceptions/types.py +0 -0
  13. orionis/services/introspection/helpers/__init__.py +0 -0
  14. orionis/services/introspection/helpers/functions.py +285 -0
  15. orionis/services/introspection/reflection.py +216 -0
  16. orionis/services/parsers/exceptions/__init__.py +0 -0
  17. orionis/services/parsers/serializer.py +1 -1
  18. orionis/services/paths/exceptions/__init__.py +0 -0
  19. orionis/services/paths/exceptions/not_found_exceptions.py +28 -0
  20. orionis/services/paths/exceptions/path_value_exceptions.py +28 -0
  21. orionis/services/paths/resolver.py +6 -4
  22. orionis/services/standard/exceptions/__init__.py +0 -0
  23. orionis/services/standard/exceptions/path_value_exceptions.py +28 -0
  24. orionis/services/standard/std.py +4 -3
  25. orionis/test/entities/test_result.py +14 -1
  26. orionis/test/exceptions/test_persistence_error.py +34 -0
  27. orionis/test/exceptions/test_runtime_error.py +26 -0
  28. orionis/test/exceptions/test_value_error.py +26 -0
  29. orionis/test/logs/contracts/__init__.py +0 -0
  30. orionis/test/logs/contracts/history.py +54 -0
  31. orionis/test/logs/history.py +372 -0
  32. orionis/test/output/contracts/dumper.py +24 -8
  33. orionis/test/output/dumper.py +52 -21
  34. orionis/test/suites/contracts/test_suite.py +27 -13
  35. orionis/test/suites/contracts/test_unit.py +101 -61
  36. orionis/test/suites/test_suite.py +57 -25
  37. orionis/test/suites/test_unit.py +559 -290
  38. orionis/unittesting.py +13 -1
  39. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/METADATA +1 -1
  40. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/RECORD +47 -27
  41. tests/services/asynchrony/test_async_io.py +3 -2
  42. tests/services/environment/test_env.py +3 -3
  43. orionis/test/logs/log_test.py +0 -211
  44. /orionis/services/parsers/{exception.py → exceptions/exception_parser.py} +0 -0
  45. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/WHEEL +0 -0
  46. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/licenses/LICENCE +0 -0
  47. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/top_level.txt +0 -0
  48. {orionis-0.282.0.dist-info → orionis-0.284.0.dist-info}/zip-safe +0 -0
@@ -0,0 +1,285 @@
1
+ import importlib
2
+ import inspect
3
+ from typing import Any, Type
4
+
5
+ class HelpersReflection:
6
+ """
7
+ A collection of helper functions for reflection and inspection.
8
+ """
9
+
10
+ @staticmethod
11
+ def isValidModule(module_name: str) -> bool:
12
+ """Check if a module name is valid and can be imported.
13
+
14
+ Parameters
15
+ ----------
16
+ module_name : str
17
+ The name of the module to check
18
+
19
+ Returns
20
+ -------
21
+ bool
22
+ True if the module is valid and can be imported, False otherwise
23
+ """
24
+ try:
25
+ importlib.import_module(module_name)
26
+ return True
27
+ except ImportError:
28
+ return False
29
+
30
+ @staticmethod
31
+ def ensureValidModule(module_name: str) -> None:
32
+ """Ensure a module name is valid and can be imported.
33
+
34
+ Parameters
35
+ ----------
36
+ module_name : str
37
+ The name of the module to check
38
+
39
+ Raises
40
+ ------
41
+ ValueError
42
+ If the module cannot be imported or is invalid
43
+ """
44
+ if not isinstance(module_name, str):
45
+ raise TypeError(f"Module name must be a string, got {type(module_name)}")
46
+ if not HelpersReflection.isValidModule(module_name):
47
+ raise ValueError(f"Invalid or non-importable module: {module_name}")
48
+
49
+ @staticmethod
50
+ def isInstantiableClass(cls: Type) -> bool:
51
+ """Check if a class is concrete and can be instantiated.
52
+
53
+ Parameters
54
+ ----------
55
+ cls : Type
56
+ The class to check
57
+
58
+ Returns
59
+ --
60
+ bool
61
+ True if the class is concrete and can be instantiated, False otherwise
62
+ """
63
+ if not isinstance(cls, type):
64
+ return False
65
+ if HelpersReflection.isAbstractClass(cls):
66
+ return False
67
+
68
+ # Try to create an instance to verify it's truly concrete
69
+ try:
70
+ cls()
71
+ return True
72
+ except TypeError:
73
+ return False
74
+
75
+ @staticmethod
76
+ def ensureNotBuiltinType(cls: Type) -> None:
77
+ """Ensure a class is not a built-in or primitive type.
78
+
79
+ Parameters
80
+ ----------
81
+ cls : Type
82
+ The class to check
83
+
84
+ Raises
85
+ ------
86
+ TypeError
87
+ If the input is not a class
88
+ ValueError
89
+ If the class is a built-in or primitive type
90
+ """
91
+ if not isinstance(cls, type):
92
+ raise TypeError(f"Expected a class, got {type(cls)}")
93
+
94
+ builtin_types = {
95
+ int, float, str, bool, bytes, type(None), complex,
96
+ list, tuple, dict, set, frozenset
97
+ }
98
+
99
+ if cls in builtin_types:
100
+ raise ValueError(f"Class '{cls.__name__}' is a built-in or primitive type and cannot be used.")
101
+
102
+ @staticmethod
103
+ def ensureInstantiableClass(cls: Type) -> None:
104
+ """Ensure a class is concrete and can be instantiated.
105
+
106
+ Parameters
107
+ ----------
108
+ cls : Type
109
+ The class to check
110
+
111
+ Raises
112
+ ------
113
+ TypeError
114
+ If the input is not a class
115
+ ValueError
116
+ If the class is abstract or cannot be instantiated
117
+ """
118
+ if HelpersReflection.ensureNotBuiltinType(cls):
119
+ raise TypeError(f"Invalid class: {cls!r}")
120
+
121
+ if not isinstance(cls, type):
122
+ raise TypeError(f"Expected a class, got {type(cls)}")
123
+
124
+ if HelpersReflection.isAbstractClass(cls):
125
+ raise ValueError(f"Class '{cls.__name__}' is abstract")
126
+
127
+ try:
128
+ cls()
129
+ except TypeError as e:
130
+ raise ValueError(f"Class '{cls.__name__}' cannot be instantiated: {str(e)}")
131
+
132
+ @staticmethod
133
+ def isValidClassName(module_name: str, class_name: str) -> bool:
134
+ """Check if a class exists in a given module.
135
+
136
+ Parameters
137
+ ----------
138
+ module_name : str
139
+ The name of the module to check
140
+ class_name : str
141
+ The name of the class to look for
142
+
143
+ Returns
144
+ -------
145
+ bool
146
+ True if the class exists in the module, False otherwise
147
+ """
148
+ try:
149
+ module = importlib.import_module(module_name)
150
+ return hasattr(module, class_name) and inspect.isclass(getattr(module, class_name))
151
+ except ImportError:
152
+ return False
153
+
154
+ @staticmethod
155
+ def ensureValidClassName(module_name: str, class_name: str) -> None:
156
+ """Ensure a class exists in a given module.
157
+
158
+ Parameters
159
+ ----------
160
+ module_name : str
161
+ The name of the module to check
162
+ class_name : str
163
+ The name of the class to look for
164
+
165
+ Raises
166
+ ------
167
+ ValueError
168
+ If the class doesn't exist in the module
169
+ """
170
+ if not HelpersReflection.isValidClassName(module_name, class_name):
171
+ raise ValueError(f"Class '{class_name}' not found in module '{module_name}'")
172
+
173
+ @staticmethod
174
+ def isUserDefinedClassInstance(instance: Any) -> bool:
175
+ """Check if an object is an instance of a user-defined class.
176
+
177
+ Parameters
178
+ ----------
179
+ instance : Any
180
+ The object to check
181
+
182
+ Returns
183
+ -------
184
+ bool
185
+ True if the object is an instance of a user-defined class, False otherwise
186
+ """
187
+ return isinstance(instance, object) and type(instance).__module__ not in {'builtins', 'abc', '__main__'}
188
+
189
+ @staticmethod
190
+ def ensureUserDefinedClassInstance(instance: Any) -> None:
191
+ """Ensure an object is an instance of a user-defined class.
192
+
193
+ Parameters
194
+ ----------
195
+ instance : Any
196
+ The object to check
197
+
198
+ Raises
199
+ ------
200
+ TypeError
201
+ If the input is not an object instance
202
+ ValueError
203
+ If the instance is from builtins, abc, or __main__
204
+ """
205
+ if not isinstance(instance, object):
206
+ raise TypeError(f"Invalid object: {instance!r}")
207
+ module = type(instance).__module__
208
+ if module in {'builtins', 'abc'}:
209
+ raise ValueError(f"'{instance!r}' is not a user-defined class instance, belongs to '{module}'.")
210
+ if module == '__main__':
211
+ raise ValueError("Instance originates from '__main__', origin indeterminate.")
212
+
213
+ @staticmethod
214
+ def isAbstractClass(cls: Type) -> bool:
215
+ """Check if a class is abstract.
216
+
217
+ Parameters
218
+ ----------
219
+ cls : Type
220
+ The class to check
221
+
222
+ Returns
223
+ -------
224
+ bool
225
+ True if the class is abstract, False otherwise
226
+ """
227
+ return isinstance(cls, type) and bool(getattr(cls, '__abstractmethods__', False))
228
+
229
+ @staticmethod
230
+ def ensureAbstractClass(cls: Type) -> None:
231
+ """Ensure a class is abstract.
232
+
233
+ Parameters
234
+ ----------
235
+ cls : Type
236
+ The class to check
237
+
238
+ Raises
239
+ ------
240
+ TypeError
241
+ If the input is not a class
242
+ ValueError
243
+ If the class is not abstract
244
+ """
245
+ if not isinstance(cls, type):
246
+ raise TypeError(f"Invalid class: {cls!r}")
247
+ if not HelpersReflection.isAbstractClass(cls):
248
+ raise ValueError(f"Class '{cls.__name__}' is not abstract.")
249
+
250
+ @staticmethod
251
+ def isConcreteClass(cls: Type) -> bool:
252
+ """Check if a class is concrete.
253
+
254
+ Parameters
255
+ ----------
256
+ cls : Type
257
+ The class to check
258
+
259
+ Returns
260
+ -------
261
+ bool
262
+ True if the class is concrete, False otherwise
263
+ """
264
+ return isinstance(cls, type) and not HelpersReflection.isAbstractClass(cls)
265
+
266
+ @staticmethod
267
+ def ensureConcreteClass(cls: Type) -> None:
268
+ """Ensure a class is concrete.
269
+
270
+ Parameters
271
+ ----------
272
+ cls : Type
273
+ The class to check
274
+
275
+ Raises
276
+ ------
277
+ TypeError
278
+ If the input is not a class
279
+ ValueError
280
+ If the class is not concrete
281
+ """
282
+ if not isinstance(cls, type):
283
+ raise TypeError(f"Invalid class: {cls!r}")
284
+ if not HelpersReflection.isConcreteClass(cls):
285
+ raise ValueError(f"Class '{cls.__name__}' is not concrete.")
@@ -0,0 +1,216 @@
1
+ import abc
2
+ from typing import Any, Type, TypeVar
3
+ from orionis._contracts.support.reflection import IReflection
4
+ from orionis.support.introspection.helpers.functions import HelpersReflection
5
+ from orionis.support.introspection.abstracts.reflect_abstract import ReflexionAbstract
6
+ from orionis.support.introspection.reflexion_concrete import ReflexionConcrete
7
+ from orionis.support.introspection.reflexion_concrete_with_abstract import ReflexionConcreteWithAbstract
8
+ from orionis.support.introspection.instances.reflection_instance import ReflectionInstance
9
+ from orionis.support.introspection.reflexion_instance_with_abstract import ReflexionInstanceWithAbstract
10
+ from orionis.support.introspection.reflexion_module import ReflexionModule
11
+ from orionis.support.introspection.reflexion_module_with_classname import ReflexionModuleWithClassName
12
+
13
+ T = TypeVar('T')
14
+ ABC = TypeVar('ABC', bound=abc.ABC)
15
+
16
+ class Reflection(IReflection):
17
+ """A static class providing factory methods for creating reflection objects.
18
+
19
+ This class provides methods to create various types of reflection objects
20
+ that encapsulate different aspects of Python's reflection capabilities.
21
+ Each method validates its inputs before creating the appropriate reflection object.
22
+
23
+ Methods
24
+ -------
25
+ instance(instance: Any) -> ReflexionInstance
26
+ Creates a reflection object for a class instance
27
+ instanceWithAbstract(instance: Any, abstract: Type[ABC]) -> ReflexionInstanceWithAbstract
28
+ Creates a reflection object for a class instance with its abstract parent
29
+ abstract(abstract: Type[ABC]) -> ReflexionAbstract
30
+ Creates a reflection object for an abstract class
31
+ concrete(concrete: Type[T]) -> ReflexionConcrete
32
+ Creates a reflection object for a concrete class
33
+ concreteWithAbstract(concrete: Type[T], abstract: Type[ABC]) -> ReflexionConcreteWithAbstract
34
+ Creates a reflection object for a concrete class with its abstract parent
35
+ module(module: str) -> ReflexionModule
36
+ Creates a reflection object for a module
37
+ moduleWithClassName(module: str, class_name: str) -> ReflexionModuleWithClassName
38
+ Creates a reflection object for a module with a specific class name
39
+ """
40
+
41
+ @staticmethod
42
+ def instance(instance: Any) -> 'ReflectionInstance':
43
+ """Create a reflection object for a class instance.
44
+
45
+ Parameters
46
+ ----------
47
+ instance : Any
48
+ The instance to reflect upon
49
+
50
+ Returns
51
+ -------
52
+ ReflectionInstance
53
+ A reflection object encapsulating the instance
54
+
55
+ Raises
56
+ ------
57
+ TypeError
58
+ If the input is not an object instance
59
+ ValueError
60
+ If the instance is from builtins, abc, or __main__
61
+ """
62
+ HelpersReflection.ensureUserDefinedClassInstance(instance)
63
+ return ReflectionInstance(instance)
64
+
65
+ @staticmethod
66
+ def instanceWithAbstract(instance: Any, abstract: Type[ABC]) -> 'ReflexionInstanceWithAbstract':
67
+ """Create a reflection object for a class instance with its abstract parent.
68
+
69
+ Parameters
70
+ ----------
71
+ instance : Any
72
+ The instance to reflect upon
73
+ abstract : Type[ABC]
74
+ The abstract parent class
75
+
76
+ Returns
77
+ -------
78
+ ReflexionInstanceWithAbstract
79
+ A reflection object encapsulating the instance and its abstract parent
80
+
81
+ Raises
82
+ ------
83
+ TypeError
84
+ If the instance is not an object or abstract is not a class
85
+ ValueError
86
+ If the instance is invalid or abstract is not actually abstract
87
+ """
88
+ HelpersReflection.ensureUserDefinedClassInstance(instance)
89
+ HelpersReflection.ensureAbstractClass(abstract)
90
+ return ReflexionInstanceWithAbstract(instance, abstract)
91
+
92
+ @staticmethod
93
+ def abstract(abstract: Type[ABC]) -> 'ReflexionAbstract':
94
+ """Create a reflection object for an abstract class.
95
+
96
+ Parameters
97
+ ----------
98
+ abstract : Type[ABC]
99
+ The abstract class to reflect upon
100
+
101
+ Returns
102
+ -------
103
+ ReflexionAbstract
104
+ A reflection object encapsulating the abstract class
105
+
106
+ Raises
107
+ ------
108
+ TypeError
109
+ If the input is not a class
110
+ ValueError
111
+ If the class is not abstract
112
+ """
113
+ HelpersReflection.ensureAbstractClass(abstract)
114
+ return ReflexionAbstract(abstract)
115
+
116
+ @staticmethod
117
+ def concrete(concrete: Type[T]) -> 'ReflexionConcrete':
118
+ """Create a reflection object for a concrete class.
119
+
120
+ Parameters
121
+ ----------
122
+ concrete : Type[T]
123
+ The concrete class to reflect upon
124
+
125
+ Returns
126
+ -------
127
+ ReflexionConcrete
128
+ A reflection object encapsulating the concrete class
129
+
130
+ Raises
131
+ ------
132
+ TypeError
133
+ If the input is not a class
134
+ ValueError
135
+ If the class is abstract or cannot be instantiated
136
+ """
137
+ HelpersReflection.ensureInstantiableClass(concrete)
138
+ return ReflexionConcrete(concrete)
139
+
140
+ @staticmethod
141
+ def concreteWithAbstract(concrete: Type[T], abstract: Type[ABC]) -> 'ReflexionConcreteWithAbstract':
142
+ """Create a reflection object for a concrete class with its abstract parent.
143
+
144
+ Parameters
145
+ ----------
146
+ concrete : Type[T]
147
+ The concrete class to reflect upon
148
+ abstract : Type[ABC]
149
+ The abstract parent class
150
+
151
+ Returns
152
+ -------
153
+ ReflexionConcreteWithAbstract
154
+ A reflection object encapsulating the concrete class and its abstract parent
155
+
156
+ Raises
157
+ ------
158
+ TypeError
159
+ If either input is not a class
160
+ ValueError
161
+ If concrete is not instantiable or abstract is not actually abstract
162
+ """
163
+ HelpersReflection.ensureInstantiableClass(concrete)
164
+ HelpersReflection.ensureAbstractClass(abstract)
165
+ return ReflexionConcreteWithAbstract(concrete, abstract)
166
+
167
+ @staticmethod
168
+ def module(module: str) -> 'ReflexionModule':
169
+ """Create a reflection object for a module.
170
+
171
+ Parameters
172
+ ----------
173
+ module : str
174
+ The module name to reflect upon
175
+
176
+ Returns
177
+ -------
178
+ ReflexionModule
179
+ A reflection object encapsulating the module
180
+
181
+ Raises
182
+ ------
183
+ TypeError
184
+ If the input is not a string
185
+ ValueError
186
+ If the module cannot be imported
187
+ """
188
+ HelpersReflection.ensureValidModule(module)
189
+ return ReflexionModule(module)
190
+
191
+ @staticmethod
192
+ def moduleWithClassName(module: str, class_name: str) -> 'ReflexionModuleWithClassName':
193
+ """Create a reflection object for a module with a specific class name.
194
+
195
+ Parameters
196
+ ----------
197
+ module : str
198
+ The module name to reflect upon
199
+ class_name : str
200
+ The class name to look for in the module
201
+
202
+ Returns
203
+ -------
204
+ ReflexionModuleWithClassName
205
+ A reflection object encapsulating the module and class name
206
+
207
+ Raises
208
+ ------
209
+ TypeError
210
+ If either input is not a string
211
+ ValueError
212
+ If the module cannot be imported or the class doesn't exist in it
213
+ """
214
+ HelpersReflection.ensureValidModule(module)
215
+ HelpersReflection.ensureValidClassName(class_name)
216
+ return ReflexionModuleWithClassName(module, class_name)
File without changes
@@ -1,4 +1,4 @@
1
- from orionis.services.parsers.exception import ExceptionParser
1
+ from orionis.services.parsers.exceptions.exception_parser import ExceptionParser
2
2
 
3
3
  class Parser:
4
4
 
File without changes
@@ -0,0 +1,28 @@
1
+ class OrionisFileNotFoundException(Exception):
2
+ """
3
+ Exception raised when a file is not found in the Orionis framework.
4
+
5
+ Args:
6
+ msg (str): A detailed message describing the missing file.
7
+
8
+ Example:
9
+ raise OrionisFileNotFoundException("File 'config.yaml' not found.")
10
+ """
11
+
12
+ def __init__(self, msg: str):
13
+ """
14
+ Initializes the exception with a custom error message.
15
+
16
+ Args:
17
+ msg (str): The error message describing the exception.
18
+ """
19
+ super().__init__(msg)
20
+
21
+ def __str__(self) -> str:
22
+ """
23
+ Return a string representation of the exception, including the class name and the first argument.
24
+
25
+ Returns:
26
+ str: A formatted string with the exception class name and the first argument.
27
+ """
28
+ return f"{self.__class__.__name__}: {self.args[0]}"
@@ -0,0 +1,28 @@
1
+ class OrionisPathValueException(Exception):
2
+ """
3
+ Exception raised when a file is not found in the Orionis framework.
4
+
5
+ Args:
6
+ msg (str): A detailed message describing the missing file.
7
+
8
+ Example:
9
+ raise OrionisFileNotFoundException("File 'config.yaml' not found.")
10
+ """
11
+
12
+ def __init__(self, msg: str):
13
+ """
14
+ Initializes the exception with a custom error message.
15
+
16
+ Args:
17
+ msg (str): The error message describing the exception.
18
+ """
19
+ super().__init__(msg)
20
+
21
+ def __str__(self) -> str:
22
+ """
23
+ Return a string representation of the exception, including the class name and the first argument.
24
+
25
+ Returns:
26
+ str: A formatted string with the exception class name and the first argument.
27
+ """
28
+ return f"{self.__class__.__name__}: {self.args[0]}"
@@ -1,6 +1,8 @@
1
1
  import os
2
2
  from pathlib import Path
3
3
  from orionis.services.paths.contracts.resolver import IResolver
4
+ from orionis.services.paths.exceptions.not_found_exceptions import OrionisFileNotFoundException
5
+ from orionis.services.paths.exceptions.path_value_exceptions import OrionisPathValueException
4
6
 
5
7
  class Resolver(IResolver):
6
8
  """
@@ -38,9 +40,9 @@ class Resolver(IResolver):
38
40
 
39
41
  Raises
40
42
  ------
41
- FileNotFoundError
43
+ OrionisFileNotFoundException
42
44
  If the resolved path does not exist.
43
- ValueError
45
+ OrionisPathValueException
44
46
  If the resolved path is neither a valid directory nor a file.
45
47
  """
46
48
  # Combine the base path with the relative path and resolve it
@@ -48,11 +50,11 @@ class Resolver(IResolver):
48
50
 
49
51
  # Validate that the path exists
50
52
  if not resolved_path.exists():
51
- raise FileNotFoundError(f"The requested path does not exist: {resolved_path}")
53
+ raise OrionisFileNotFoundException(f"The requested path does not exist: {resolved_path}")
52
54
 
53
55
  # Validate that the path is either a directory or a file
54
56
  if not (resolved_path.is_dir() or resolved_path.is_file()):
55
- raise ValueError(f"The requested path is neither a valid directory nor a file: {resolved_path}")
57
+ raise OrionisPathValueException(f"The requested path is neither a valid directory nor a file: {resolved_path}")
56
58
 
57
59
  # Store the resolved path in the instance variable
58
60
  self.resolved_path = resolved_path
File without changes
@@ -0,0 +1,28 @@
1
+ class OrionisStdValueException(Exception):
2
+ """
3
+ Exception raised for standard value errors in the Orionis framework.
4
+
5
+ Args:
6
+ msg (str): A detailed message describing the value error.
7
+
8
+ Example:
9
+ raise OrionisStdValueException("Invalid value for parameter 'timeout'.")
10
+ """
11
+
12
+ def __init__(self, msg: str):
13
+ """
14
+ Initializes the exception with a custom error message.
15
+
16
+ Args:
17
+ msg (str): The error message describing the exception.
18
+ """
19
+ super().__init__(msg)
20
+
21
+ def __str__(self) -> str:
22
+ """
23
+ Return a string representation of the exception, including the class name and the first argument.
24
+
25
+ Returns:
26
+ str: A formatted string with the exception class name and the first argument.
27
+ """
28
+ return f"{self.__class__.__name__}: {self.args[0]}"
@@ -1,4 +1,5 @@
1
1
  from orionis.services.standard.contracts.std import IStdClass
2
+ from orionis.services.standard.exceptions.path_value_exceptions import OrionisStdValueException
2
3
 
3
4
  class StdClass(IStdClass):
4
5
  """
@@ -81,14 +82,14 @@ class StdClass(IStdClass):
81
82
 
82
83
  Raises
83
84
  ------
84
- ValueError
85
+ OrionisStdValueException
85
86
  If an attribute name is invalid or conflicts with existing methods.
86
87
  """
87
88
  for key, value in kwargs.items():
88
89
  if key.startswith('__') and key.endswith('__'):
89
- raise ValueError(f"Cannot set attribute with reserved name: {key}")
90
+ raise OrionisStdValueException(f"Cannot set attribute with reserved name: {key}")
90
91
  if hasattr(self.__class__, key):
91
- raise ValueError(f"Cannot set attribute '{key}' as it conflicts with a class method")
92
+ raise OrionisStdValueException(f"Cannot set attribute '{key}' as it conflicts with a class method")
92
93
  setattr(self, key, value)
93
94
 
94
95
  def remove(self, *attributes):
@@ -5,9 +5,22 @@ from orionis.test.enums.test_status import TestStatus
5
5
  @dataclass(frozen=True, kw_only=True)
6
6
  class TestResult:
7
7
  """
8
- Represents the result of a test execution.
8
+ Represents the result of a test execution, including status, timing, and error details.
9
+ Attributes:
10
+ id (Any): Unique identifier for the test result.
11
+ name (str): Name of the test.
12
+ status (TestStatus): Status of the test execution (e.g., passed, failed).
13
+ execution_time (float): Time taken to execute the test, in seconds.
14
+ error_message (Optional[str]): Error message if the test failed, otherwise None.
15
+ traceback (Optional[str]): Traceback information if an error occurred, otherwise None.
16
+ class_name (Optional[str]): Name of the class containing the test, if applicable.
17
+ method (Optional[str]): Name of the method representing the test, if applicable.
18
+ module (Optional[str]): Name of the module containing the test, if applicable.
19
+ file_path (Optional[str]): Path to the file containing the test, if applicable.
20
+ doc_string (Optional[str]): Docstring of the test, if applicable.
9
21
  """
10
22
 
23
+
11
24
  id: Any = field(
12
25
  metadata={
13
26
  "description": "Unique identifier for the test result."