Repository navigation
Expand file tree
/
Copy pathtests_input_fields.py
More file actions
84 lines (58 loc) · 2.74 KB
/
Copy pathtests_input_fields.py
File metadata and controls
84 lines (58 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
79
80
81
82
83
84
"""
----------------------------------------------------------------------------------------------------------------------------------
_______. ______ __ ___ .__ __..___________.|| __ __ __ __________ ___ ._______ ._____
/ | / || | / \ | \ | || |//\ \ / /| ||______ | / \ | _ \| _ \
| (----`| ,----'| | / ^ \ | \| |`---| |----` \ \ ^ / / | | _/ _/ / ^ \ | |_) || | \ \
\ \ | | | | / /_\ \ | . ` | | | \ \ / \ / / | | _/ _/ / /_\ \ | ____/| | ) |
.----) | | `----.| | / _____ \ | |\ | | | \ v v / | | _/ _/____ / _____ \ | |\ \ | |_/ /
|_______/ \______||__|/__/ \__\|__| \__| |__| \__/^\__/ |__||__________|/__/ \__\|__| \__\|_____/
----------------------------------------------------------------------------------------------------------------------------------
Originally developed by G. Léandre
Version : 1.5.1
Year : 2026
Authors : G. Léandre
"""
import os
import classes
# No setup needed here
"""
print("Setup...")
test_path = "test_templates/"
print(f"Emptying the test directory ({test_path})...")
for elt in os.listdir(f"./{test_path}"):
os.remove(f"./{test_path}{elt}")
"""
print("\n+----------------------------------------+")
print("| Testing the InputFields sub-module |")
print("+----------------------------------------+\n")
print("\n+-------------------------------------+")
print("| Testing the SetInputField class |")
print("+-------------------------------------+\n")
print("\tInstanciating the class...")
B_set = classes.SetInputField(0, [0, 2])
print(f"\tThe class has the value : {B_set.getValue()}")
print("\tSetting the value to an allowed value (2)...")
B_set.setValue(2)
print(f"\tThe class has the value : {B_set.getValue()}")
print("\tSetting the value to an unallowed value (1)...")
try:
B_set.setValue(1)
except ValueError:
print("\t\tValueError...")
print(f"\tThe class has the value : {B_set.getValue()}")
print("\n+------------------------------------------+")
print("| Testing the IntervalInputField class |")
print("+------------------------------------------+\n")
print("\tInstanciating the class...")
B_int = classes.IntervalInputField(0, 0, 5)
print(f"\tThe class has the value : {B_int.getValue()}")
print("\tSetting the value to an allowed value (2)...")
B_int.setValue(2)
print(f"\tThe class has the value : {B_int.getValue()}")
print("\tSetting the value to an unallowed value (6)...")
try:
B_int.setValue(6)
except ValueError:
print("\t\tValueError...")
print(f"\tThe class has the value : {B_int.getValue()}")
print()