articlib 0.2.3__py3-none-any.whl → 0.2.5__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/testEngine.py CHANGED
@@ -1,111 +1,128 @@
1
- import articlib.articLogger as logger
2
- from articlib.consoleUtils import printRed, printGreen, printYellow, printMagenta, printGreenBold, printRedBold
3
-
4
- class testEngine:
5
- def __init__(self):
6
- self.passed = True
7
- self.failed = False
8
- self.escenarioPassed = True
9
- self.escenarioFailed = False
10
- self.testCount = 0
11
- self.scenarioCount = 0
12
- self.passCount = 0
13
- self.failCount = 0
14
- self.skipCount = 0
15
-
16
- def testIfTrue(self, test, message):
17
- if self.escenarioPassed:
18
- self.testCount += 1
19
- if test:
20
- self.passCount += 1
21
- printGreen(f"\tTest {self.testCount} passed: {message}")
22
- return 1
23
- else:
24
- self.failCount += 1
25
- printRed(f"\tTest {self.testCount} failed: {message}")
26
- self.scenarioPassed = False
27
- self.scenarioFailed= True
28
- return 2
29
- else:
30
- self.skipCount += 1
31
- printYellow(f"\tTest {self.testCount} skipped: {message}")
32
- return 3
33
-
34
- def testIfFalse(self, test, message):
35
- self.testIfTrue(not test, message)
36
-
37
- def testIfEqual(self, expected, testValue, message):
38
- response = self.testIfTrue(expected == testValue, message)
39
- if response == 2:
40
- printMagenta(f"\t\tExpected value equal to {expected}")
41
- printMagenta(f"\t\tValue equal to {testValue}")
42
-
43
- def testIfNotEqual(self, expected, testValue, message):
44
- response = self.testIftrue(expected != testValue, message)
45
- if response == 2:
46
- printMagenta(f"\t\tExpected value differen to {expected}")
47
- printMagenta(f"\t\tValue equal to {testValue}")
48
-
49
- def testIfGreater(self, expected, testValue, message):
50
- response = self.testIftrue(expected > testValue, message)
51
- if response == 2:
52
- printMagenta(f"\t\tExpected value greater than {expected}")
53
- printMagenta(f"\t\tValue equal to {testValue}")
54
-
55
- def testIfGreaterEqual(self, expected, testValue, message):
56
- response = self.testIftrue(expected >= testValue, message)
57
- if response == 2:
58
- printMagenta(f"\t\tExpected value greater or equal than {expected}")
59
- printMagenta(f"\t\tValue equal to {testValue}")
60
-
61
- def testIfLess(self, expected, testValue, message):
62
- response = self.testIftrue(expected < testValue, message)
63
- if response == 2:
64
- printMagenta(f"\t\tExpected value less than {expected}")
65
- printMagenta(f"\t\tValue equal to {testValue}")
66
-
67
- def testIfLessEqual(self, expected, testValue, message):
68
- response = self.testIftrue(expected <= testValue, message)
69
- if response == 2:
70
- printMagenta(f"\t\tExpected value less or equal than {expected}")
71
- printMagenta(f"\t\tValue equal to {testValue}")
72
-
73
- def newScenario(self, name):
74
- self.scenarioCount += 1
75
- print(f"Starting scenario {self.scenarioCount}: {name}")
76
-
77
- def endScenario(self, name):
78
- if self.escenarioPassed:
79
- print(f"Scenario {self.scenarioCount}:{name} ended with result: PASSED")
80
- else:
81
- print(f"Scenario {self.scenarioCount}:{name} ended with result: FAILED")
82
- if self.escenarioFailed:
83
- self.passed = False
84
- self.failed = True
85
- self.escenarioPassed = True
86
- self.escenarioFailed = False
87
-
88
-
89
- # Output test results in different ways
90
- def printResults(self):
91
- if self.passed:
92
- printGreenBold("TEST PASSED")
93
- else:
94
- printRedBold("TEST FAILED")
95
- print(f"\t {self.scenarioCount} scenarios")
96
- print(f"\t {self.testCount} tests")
97
- print(f"\t {self.passCount} passed")
98
- print(f"\t {self.failCount} failed")
99
- print(f"\t {self.skipCount} skipped")
100
-
101
- def lofResults(self, log):
102
- if self.passed:
103
- logger.addEntry("TEST PASSED", log.INFO_MASK)
104
- else:
105
- logger.addEntry("TEST FAILED", log.ERROR_MASK)
106
- logger.addEntry(f"\t {self.passCount} passed\n")
107
- logger.addEntry(f"\t {self.failCount} failed\n")
108
- logger.addEntry(f"\t {self.skipCount} skipped\n")
109
- logger.addEntry(f"\t {self.testCount} total\n")
110
-
111
- test = testEngine()
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(
67
+ f"""\t\tExpected value greater
68
+ or equal than {expected}"""
69
+ )
70
+ printMagenta(f"\t\tValue equal to {testValue}")
71
+
72
+ def testIfLess(self, expected, testValue, message):
73
+ response = self.testIftrue(expected < testValue, message)
74
+ if response == 2:
75
+ printMagenta(f"\t\tExpected value less than {expected}")
76
+ printMagenta(f"\t\tValue equal to {testValue}")
77
+
78
+ def testIfLessEqual(self, expected, testValue, message):
79
+ response = self.testIftrue(expected <= testValue, message)
80
+ if response == 2:
81
+ printMagenta(f"\t\tExpected value less or equal than {expected}")
82
+ printMagenta(f"\t\tValue equal to {testValue}")
83
+
84
+ def newScenario(self, name):
85
+ self.scenarioCount += 1
86
+ print(f"Starting scenario {self.scenarioCount}: {name}")
87
+
88
+ def endScenario(self, name):
89
+ if self.escenarioPassed:
90
+ print(
91
+ f"""Scenario {self.scenarioCount}:{name} ended
92
+ with result: PASSED"""
93
+ )
94
+ else:
95
+ print(
96
+ f"""Scenario {self.scenarioCount}:{name} ended
97
+ with result: FAILED"""
98
+ )
99
+ if self.escenarioFailed:
100
+ self.passed = False
101
+ self.failed = True
102
+ self.escenarioPassed = True
103
+ self.escenarioFailed = False
104
+
105
+ # Output test results in different ways
106
+ def printResults(self):
107
+ if self.passed:
108
+ printGreenBold("TEST PASSED")
109
+ else:
110
+ printRedBold("TEST FAILED")
111
+ print(f"\t {self.scenarioCount} scenarios")
112
+ print(f"\t {self.testCount} tests")
113
+ print(f"\t {self.passCount} passed")
114
+ print(f"\t {self.failCount} failed")
115
+ print(f"\t {self.skipCount} skipped")
116
+
117
+ def lofResults(self, log):
118
+ if self.passed:
119
+ logger.addEntry("TEST PASSED", log.INFO_MASK)
120
+ else:
121
+ logger.addEntry("TEST FAILED", log.ERROR_MASK)
122
+ logger.addEntry(f"\t {self.passCount} passed\n")
123
+ logger.addEntry(f"\t {self.failCount} failed\n")
124
+ logger.addEntry(f"\t {self.skipCount} skipped\n")
125
+ logger.addEntry(f"\t {self.testCount} total\n")
126
+
127
+
128
+ 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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: articlib
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: Small set of tools and utilities in python. Destined to be use in my personal projects.
5
5
  License: MIT
6
6
  Author: Artic42
@@ -0,0 +1,12 @@
1
+ articlib/articFileUtils.py,sha256=6DEL_3aBdHT4327dXH937CrI1Q3E87wMHRICJKcbi6k,2004
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=w6OvaJy2kYd_s0HS13GabBoNeJHaTVy1GPpjKSVJJI8,4507
9
+ articlib-0.2.5.dist-info/LICENSE,sha256=3-aTTjabtkZs4isOSc-gRzV0yFur4FhDOXt61keEaqo,1073
10
+ articlib-0.2.5.dist-info/METADATA,sha256=iI07rO8r3FHcqTPlmQQOIkGXjfUkJyNv-hM-YI9Nz7M,1958
11
+ articlib-0.2.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
+ articlib-0.2.5.dist-info/RECORD,,
@@ -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=MYVMzippQ6rEwj3_WPlOaP3uTA1Pk-c0Fp8vrcwUKGk,2509
7
- articlib/systemUtils.py,sha256=-XKMGSxi8UCDEdYrZCUnLwpO1SVKWzP0jmvbYbH9QW8,838
8
- articlib/testEngine.py,sha256=uoRr4FkAvRrvtB9g-mKc1KSspoka0eEBy_X0vSJ3eUA,4502
9
- articlib-0.2.3.dist-info/LICENSE,sha256=NiJJ2y6nD9BVS9EdxmP4lbFxjoNE3CIvx4PaquX5Dvs,1094
10
- articlib-0.2.3.dist-info/METADATA,sha256=7DL2BWxEE9WPvTrbqMkhQAtdOgAgwSiXg5SaQJ56yvQ,1958
11
- articlib-0.2.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
- articlib-0.2.3.dist-info/RECORD,,