articlib 0.2.2__py3-none-any.whl → 0.2.4__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.
Potentially problematic release.
This version of articlib might be problematic. Click here for more details.
- articlib/articFileUtils.py +66 -58
- articlib/articLogger.py +106 -102
- articlib/consoleUtils.py +46 -36
- articlib/dateTime.py +155 -121
- articlib/dice.py +35 -32
- articlib/sqliteEngine.py +69 -66
- articlib/systemUtils.py +33 -34
- articlib/testEngine.py +122 -111
- {articlib-0.2.2.dist-info → articlib-0.2.4.dist-info}/LICENSE +21 -21
- {articlib-0.2.2.dist-info → articlib-0.2.4.dist-info}/METADATA +1 -1
- articlib-0.2.4.dist-info/RECORD +12 -0
- articlib-0.2.2.dist-info/RECORD +0 -12
- {articlib-0.2.2.dist-info → articlib-0.2.4.dist-info}/WHEEL +0 -0
articlib/testEngine.py
CHANGED
|
@@ -1,111 +1,122 @@
|
|
|
1
|
-
import articlib.articLogger as logger
|
|
2
|
-
from articlib.consoleUtils import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
self.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
1
|
+
import articlib.articLogger as logger
|
|
2
|
+
from articlib.consoleUtils import (
|
|
3
|
+
printRed,
|
|
4
|
+
printGreen,
|
|
5
|
+
printYellow,
|
|
6
|
+
printMagenta,
|
|
7
|
+
printGreenBold,
|
|
8
|
+
printRedBold,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class testEngine:
|
|
13
|
+
def __init__(self):
|
|
14
|
+
self.passed = True
|
|
15
|
+
self.failed = False
|
|
16
|
+
self.escenarioPassed = True
|
|
17
|
+
self.escenarioFailed = False
|
|
18
|
+
self.testCount = 0
|
|
19
|
+
self.scenarioCount = 0
|
|
20
|
+
self.passCount = 0
|
|
21
|
+
self.failCount = 0
|
|
22
|
+
self.skipCount = 0
|
|
23
|
+
|
|
24
|
+
def testIfTrue(self, test, message):
|
|
25
|
+
if self.escenarioPassed:
|
|
26
|
+
self.testCount += 1
|
|
27
|
+
if test:
|
|
28
|
+
self.passCount += 1
|
|
29
|
+
printGreen(f"\tTest {self.testCount} passed: {message}")
|
|
30
|
+
return 1
|
|
31
|
+
else:
|
|
32
|
+
self.failCount += 1
|
|
33
|
+
printRed(f"\tTest {self.testCount} failed: {message}")
|
|
34
|
+
self.scenarioPassed = False
|
|
35
|
+
self.scenarioFailed = True
|
|
36
|
+
return 2
|
|
37
|
+
else:
|
|
38
|
+
self.skipCount += 1
|
|
39
|
+
printYellow(f"\tTest {self.testCount} skipped: {message}")
|
|
40
|
+
return 3
|
|
41
|
+
|
|
42
|
+
def testIfFalse(self, test, message):
|
|
43
|
+
self.testIfTrue(not test, message)
|
|
44
|
+
|
|
45
|
+
def testIfEqual(self, expected, testValue, message):
|
|
46
|
+
response = self.testIfTrue(expected == testValue, message)
|
|
47
|
+
if response == 2:
|
|
48
|
+
printMagenta(f"\t\tExpected value equal to {expected}")
|
|
49
|
+
printMagenta(f"\t\tValue equal to {testValue}")
|
|
50
|
+
|
|
51
|
+
def testIfNotEqual(self, expected, testValue, message):
|
|
52
|
+
response = self.testIftrue(expected != testValue, message)
|
|
53
|
+
if response == 2:
|
|
54
|
+
printMagenta(f"\t\tExpected value differen to {expected}")
|
|
55
|
+
printMagenta(f"\t\tValue equal to {testValue}")
|
|
56
|
+
|
|
57
|
+
def testIfGreater(self, expected, testValue, message):
|
|
58
|
+
response = self.testIftrue(expected > testValue, message)
|
|
59
|
+
if response == 2:
|
|
60
|
+
printMagenta(f"\t\tExpected value greater than {expected}")
|
|
61
|
+
printMagenta(f"\t\tValue equal to {testValue}")
|
|
62
|
+
|
|
63
|
+
def testIfGreaterEqual(self, expected, testValue, message):
|
|
64
|
+
response = self.testIftrue(expected >= testValue, message)
|
|
65
|
+
if response == 2:
|
|
66
|
+
printMagenta(f"""\t\tExpected value greater
|
|
67
|
+
or equal than {expected}""")
|
|
68
|
+
printMagenta(f"\t\tValue equal to {testValue}")
|
|
69
|
+
|
|
70
|
+
def testIfLess(self, expected, testValue, message):
|
|
71
|
+
response = self.testIftrue(expected < testValue, message)
|
|
72
|
+
if response == 2:
|
|
73
|
+
printMagenta(f"\t\tExpected value less than {expected}")
|
|
74
|
+
printMagenta(f"\t\tValue equal to {testValue}")
|
|
75
|
+
|
|
76
|
+
def testIfLessEqual(self, expected, testValue, message):
|
|
77
|
+
response = self.testIftrue(expected <= testValue, message)
|
|
78
|
+
if response == 2:
|
|
79
|
+
printMagenta(f"\t\tExpected value less or equal than {expected}")
|
|
80
|
+
printMagenta(f"\t\tValue equal to {testValue}")
|
|
81
|
+
|
|
82
|
+
def newScenario(self, name):
|
|
83
|
+
self.scenarioCount += 1
|
|
84
|
+
print(f"Starting scenario {self.scenarioCount}: {name}")
|
|
85
|
+
|
|
86
|
+
def endScenario(self, name):
|
|
87
|
+
if self.escenarioPassed:
|
|
88
|
+
print(f"""Scenario {self.scenarioCount}:{name} ended
|
|
89
|
+
with result: PASSED""")
|
|
90
|
+
else:
|
|
91
|
+
print(f"""Scenario {self.scenarioCount}:{name} ended
|
|
92
|
+
with result: FAILED""")
|
|
93
|
+
if self.escenarioFailed:
|
|
94
|
+
self.passed = False
|
|
95
|
+
self.failed = True
|
|
96
|
+
self.escenarioPassed = True
|
|
97
|
+
self.escenarioFailed = False
|
|
98
|
+
|
|
99
|
+
# Output test results in different ways
|
|
100
|
+
def printResults(self):
|
|
101
|
+
if self.passed:
|
|
102
|
+
printGreenBold("TEST PASSED")
|
|
103
|
+
else:
|
|
104
|
+
printRedBold("TEST FAILED")
|
|
105
|
+
print(f"\t {self.scenarioCount} scenarios")
|
|
106
|
+
print(f"\t {self.testCount} tests")
|
|
107
|
+
print(f"\t {self.passCount} passed")
|
|
108
|
+
print(f"\t {self.failCount} failed")
|
|
109
|
+
print(f"\t {self.skipCount} skipped")
|
|
110
|
+
|
|
111
|
+
def lofResults(self, log):
|
|
112
|
+
if self.passed:
|
|
113
|
+
logger.addEntry("TEST PASSED", log.INFO_MASK)
|
|
114
|
+
else:
|
|
115
|
+
logger.addEntry("TEST FAILED", log.ERROR_MASK)
|
|
116
|
+
logger.addEntry(f"\t {self.passCount} passed\n")
|
|
117
|
+
logger.addEntry(f"\t {self.failCount} failed\n")
|
|
118
|
+
logger.addEntry(f"\t {self.skipCount} skipped\n")
|
|
119
|
+
logger.addEntry(f"\t {self.testCount} total\n")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
test = testEngine()
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Iñaki Arrondo
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Iñaki Arrondo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
articlib/articFileUtils.py,sha256=pzQgnKQqoGma9N9JIx2e4OGKvd_9EFQ5D26t6wosgOs,1300
|
|
2
|
+
articlib/articLogger.py,sha256=ebdrn2V6DwTBm2kuyZS6Hav-olyf8CgQ6Oc2iLZUQcw,2922
|
|
3
|
+
articlib/consoleUtils.py,sha256=lGRazY1upmUTbPR0kXqg9C_Nxmc9xH580WcN8TOK-BI,932
|
|
4
|
+
articlib/dateTime.py,sha256=heTdkfYgTCQ5PMcA94zn_r4bLDgmycOTs8-wFwFYas8,4303
|
|
5
|
+
articlib/dice.py,sha256=eqKRuddChCldl9O11c0_Q2ne9moixusABb_GjmDP8Dk,798
|
|
6
|
+
articlib/sqliteEngine.py,sha256=bG1yaxJR0LdY9v2gJyjwnnYPzSs5lQvmtiYwYoim9jY,2394
|
|
7
|
+
articlib/systemUtils.py,sha256=6HXFCtq5PbosgyBwyHPz4MsJlBu0u-EkZN9Gror3dro,803
|
|
8
|
+
articlib/testEngine.py,sha256=n0tAKv6ioyHOw_IWxK9xv4KTcHhbVvkzqcFKrISScmQ,4417
|
|
9
|
+
articlib-0.2.4.dist-info/LICENSE,sha256=3-aTTjabtkZs4isOSc-gRzV0yFur4FhDOXt61keEaqo,1073
|
|
10
|
+
articlib-0.2.4.dist-info/METADATA,sha256=lDwsQqjWki6jY3CQgZVnsGGt4Nlr4LUfzxBKb394lfU,1958
|
|
11
|
+
articlib-0.2.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
12
|
+
articlib-0.2.4.dist-info/RECORD,,
|
articlib-0.2.2.dist-info/RECORD
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
articlib/articFileUtils.py,sha256=slaNatD4wO_T5uecfOv7qcMDWegZ2t-V3go5hcv9z38,1396
|
|
2
|
-
articlib/articLogger.py,sha256=GqtO1_Mz1-Vu7aIO9CjJCzHflWNkRDtIy4uZsfneKvc,3072
|
|
3
|
-
articlib/consoleUtils.py,sha256=cXf9omWUAg66a_uCz5Yoi20nWB9Cmd6FaiE6ZgPcchw,980
|
|
4
|
-
articlib/dateTime.py,sha256=IGFuD9dluD2vhurfPVBz0FlOmKpiWTqqUFWWKN55uAw,4020
|
|
5
|
-
articlib/dice.py,sha256=TQI1PKyvXekwUPB2n3fMuvnW8lVlV7TmtWjBSLYlw0s,772
|
|
6
|
-
articlib/sqliteEngine.py,sha256=2UlZHEYw3BUQ9w6lG0yRvMyMvnRj-MOIunwZnDJaF6U,2505
|
|
7
|
-
articlib/systemUtils.py,sha256=-XKMGSxi8UCDEdYrZCUnLwpO1SVKWzP0jmvbYbH9QW8,838
|
|
8
|
-
articlib/testEngine.py,sha256=uoRr4FkAvRrvtB9g-mKc1KSspoka0eEBy_X0vSJ3eUA,4502
|
|
9
|
-
articlib-0.2.2.dist-info/LICENSE,sha256=NiJJ2y6nD9BVS9EdxmP4lbFxjoNE3CIvx4PaquX5Dvs,1094
|
|
10
|
-
articlib-0.2.2.dist-info/METADATA,sha256=ttMoj6gXVJDklYc2rk0aKyIGf9Rs-u6wD0x1A_iLN2c,1958
|
|
11
|
-
articlib-0.2.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
12
|
-
articlib-0.2.2.dist-info/RECORD,,
|
|
File without changes
|