Zappy - Year end project 2
This is a project that Epitech asked us to create in order to allow us to reveiw the notions of the current year.
Loading...
Searching...
No Matches
test_constants.py
Go to the documentation of this file.
7"""! @brief Example program for running unit tests variables """
8
9# Imports
10import unittest
11
12
13class CI:
14 """! Just a dummy class with data """
15 ERR = 84
16 ERROR = ERR
17 SUCCESS = 0
18
19# TTY colour options
20 COLOURS = {
21 "default": "0A",
22 "prompt": "0B",
23 "error": "0C",
24 "success": "03",
25 "info": "0D",
26 "reset": "rr",
27 "help_title_colour": "0E",
28 "help_command_colour": "0A",
29 "help_description_colour": "0F",
30 "env_term_colour": "09",
31 "env_shell_colour": "03",
32 "env_definition_colour": "0B",
33 "session_name_colour": "0D"
34 }
35
36
37# Initialisation of the dummy class CI
38C = CI()
39
40
41class TestConstants(unittest.TestCase):
42 """! Test the constants from the dummy class CI """
43
44 def test_status_codes(self) -> None:
45 """! Check the status codes
46 @param self The self function of the program
47 """
48 self.assertEqual(C.ERR, 84)
49 self.assertEqual(C.ERROR, C.ERR)
50 self.assertEqual(C.SUCCESS, 0)
51
52 def test_colour_codes(self) -> None:
53 """! Check the colour codes
54 @param self The self function of the program
55 """
56 expected_colours = {
57 "default": "0A",
58 "prompt": "0B",
59 "error": "0C",
60 "success": "03",
61 "info": "0D",
62 "reset": "rr",
63 "help_title_colour": "0E",
64 "help_command_colour": "0A",
65 "help_description_colour": "0F",
66 "env_term_colour": "09",
67 "env_shell_colour": "03",
68 "env_definition_colour": "0B",
69 "session_name_colour": "0D"
70 }
71 self.assertEqual(C.COLOURS, expected_colours)
72
73
74if __name__ == '__main__':
75 print("Running tests for constants.py")
76 unittest.main()
Just a dummy class with data.
Test the constants from the dummy class CI.
None test_status_codes(self)
Check the status codes.
None test_colour_codes(self)
Check the colour codes.