pyquoks 2.4.0__py3-none-any.whl → 2.5.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.
pyquoks/test.py DELETED
@@ -1,129 +0,0 @@
1
- import types
2
- import typing
3
- import unittest
4
-
5
- from . import data
6
- from . import utils
7
-
8
-
9
- class TestCase(unittest.TestCase, utils._HasRequiredAttributes):
10
- """
11
- Class for performing unit testing
12
-
13
- **Required attributes**::
14
-
15
- _MODULE_NAME = __name__
16
-
17
- Attributes:
18
- _MODULE_NAME: Name of the testing module
19
- """
20
-
21
- _REQUIRED_ATTRIBUTES = {
22
- "_MODULE_NAME"
23
- }
24
-
25
- _MODULE_NAME: str
26
-
27
- def __init__(self, *args, **kwargs) -> None:
28
- self._check_attributes()
29
-
30
- super().__init__(*args, **kwargs)
31
-
32
- @classmethod
33
- def setUpClass(cls) -> None:
34
- super().setUpClass()
35
-
36
- cls._logger = data.LoggerService(
37
- filename=cls._MODULE_NAME,
38
- path=utils.get_path("tests/logs/"),
39
- )
40
-
41
- def _get_func_name(self, func_name: str) -> str:
42
- return f"{self._MODULE_NAME}.{func_name}"
43
-
44
- def assert_equal(
45
- self,
46
- func_name: str,
47
- test_data: object,
48
- test_expected: object,
49
- message: str = None,
50
- ) -> None:
51
- self._logger.info(
52
- msg=(
53
- f"{self._get_func_name(func_name)}:\n"
54
- f"{f"Message: {message}\n" if message else ""}"
55
- f"Data: {test_data}\n"
56
- f"Expected: {test_expected}\n"
57
- ),
58
- )
59
-
60
- try:
61
- self.assertEqual(
62
- first=test_data,
63
- second=test_expected,
64
- msg=message,
65
- )
66
- except Exception as exception:
67
- self._logger.log_error(
68
- exception=exception,
69
- raise_again=True,
70
- )
71
-
72
- def assert_raises(
73
- self,
74
- func_name: str,
75
- test_func: typing.Callable,
76
- test_exception: type[BaseException],
77
- message: str = None,
78
- *args,
79
- **kwargs,
80
- ) -> None:
81
- self._logger.info(
82
- msg=(
83
- f"{self._get_func_name(func_name)}:\n"
84
- f"{f"Message: {message}\n" if message else ""}"
85
- f"Function: {test_func.__name__}()\n"
86
- f"Exception: {test_exception.__name__}\n"
87
- ),
88
- )
89
-
90
- try:
91
- self.assertRaises(
92
- test_exception,
93
- test_func,
94
- *args,
95
- **kwargs,
96
- )
97
- except Exception as exception:
98
- self._logger.log_error(
99
- exception=exception,
100
- raise_again=True,
101
- )
102
-
103
- def assert_type(
104
- self,
105
- func_name: str,
106
- test_data: object,
107
- test_type: type | types.UnionType,
108
- message: str = None,
109
- ) -> None:
110
- self._logger.info(
111
- msg=(
112
- f"{self._get_func_name(func_name)}:\n"
113
- f"{f"Message: {message}\n" if message else ""}"
114
- f"Type: {type(test_data).__name__}\n"
115
- f"Expected: {test_type.__name__}\n"
116
- ),
117
- )
118
-
119
- try:
120
- self.assertIsInstance(
121
- obj=test_data,
122
- cls=test_type,
123
- msg=message,
124
- )
125
- except Exception as exception:
126
- self._logger.log_error(
127
- exception=exception,
128
- raise_again=True,
129
- )
@@ -1,8 +0,0 @@
1
- pyquoks/__init__.py,sha256=ptZEkhgvtkE_QkYALg8Ke70jSh02rI7piDHy-CDSZ50,119
2
- pyquoks/data.py,sha256=bYS_iXOcH5bVqBdKi9xOdlKaUjerTolgrP2N2idhv-Y,19459
3
- pyquoks/test.py,sha256=u0uyABZPw_Xdxy3nFRYkYGySqV6CuhzyPqbIWPi55xU,3450
4
- pyquoks/utils.py,sha256=shCyMYgpg8pGSJLuHqO4nEWDeTOAc7b5BjlgDVhvZV4,1861
5
- pyquoks-2.4.0.dist-info/licenses/LICENSE,sha256=WYK66zwaBlCe_GnOwRCLlJCQibJ8oyqvpZ1CCsrcg2k,1095
6
- pyquoks-2.4.0.dist-info/METADATA,sha256=RjMwuA1Y5TfY4dHhoNOuV0c8Y8tfWgykf70p65aQ4d0,1251
7
- pyquoks-2.4.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
8
- pyquoks-2.4.0.dist-info/RECORD,,