Skip to content

Commit f14f1fb

Browse files
Added color test
1 parent 09597bf commit f14f1fb

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

test.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,46 @@
88
# Function that show all tests.
99
def all_tests():
1010
print('--- DOING ALL TESTS ---')
11-
sleep(1)
11+
sleep(2)
12+
13+
print('Test table printing (only providing recordset).')
14+
sleep(2)
1215
test_table()
1316
sleep(4)
1417
print('#' * 60)
1518

19+
print('Test table printing with colors (the colors are provided by user in the dataset).')
20+
sleep(2)
21+
test_table_with_colors()
22+
sleep(4)
23+
print('#' * 60)
24+
1625
print('Test of an Oneline object.')
17-
sleep(1)
26+
sleep(2)
1827
test_oneline()
1928
sleep(4)
2029
print('#' * 60)
2130

2231
print('Test of a Table object, configured to show errors.')
23-
sleep(1)
32+
sleep(2)
2433
test_table_show_errors()
2534
sleep(4)
2635
print('#' * 60)
2736

2837
print('Test of a Table object, configured to show errors.')
29-
sleep(1)
38+
sleep(2)
3039
test_table_show_errors()
3140
sleep(4)
3241
print('#' * 60)
3342

3443
print('Test of a Table object, customized to show how the parameters works.')
35-
sleep(1)
44+
sleep(2)
3645
test_customized_table()
3746
sleep(4)
3847
print('#' * 60)
3948

4049
print('Test of a table object, to show how works width without automatical assignement deactivated.')
41-
sleep(1)
50+
sleep(2)
4251
test_table_width_false()
4352
sleep(4)
4453
print('#' * 60)
@@ -52,8 +61,9 @@ def create_motors():
5261
global motor_oneline
5362
motor_oneline = outfancy.render.Oneline()
5463

55-
# It defines the recordset, a set of data prepared for test purposes.
64+
# It defines the recordset and the color_recordset, sets of data prepared for test purposes.
5665
recordset = [(1, 'Feisbuk', '18-10-2015', '21:57:17', '18-10-2015', '21:57:17', 1234, 'Social network bla bla bla used by people bla bla.'), (2, 'Gugle', '18-10-2015', '21:57:44', '18-10-2015', '21:57:44', 12323, 'Search engine that categorize results using an algorithm that bla bla bla.'), (3, 'Opera', '18-10-2015', '21:58:39', '18-10-2015', '21:58:39', 4324, 'Navegador de internerd, también es una disciplina musical, que, valga la redundancia, requiere de una brutal disciplina por parte de los interpretes.'), (4, 'Audi', '18-10-2015', '21:59:51', '18-10-2015', '21:59:51', 0, 'OOOO <-- Fabricante alemán de vehiculos de alta gama.'), (5, 'The Simpsons', '18-10-2015', '22:0:44', '18-10-2015', '22:0:44', 0, 'Una sitcom que lleva veintipico de temporadas, si no la viste, se puede presumir que vivís bajo una piedra.'), (6, 'BMW', '18-10-2015', '22:1:18', '18-10-2015', '22:1:18', 98765, 'Fabricante alemán de autos de lujo.'), (7, 'Yahoo', '18-10-2015', '22:1:56', '18-10-2015', '22:1:56', 53430, 'Expresión de alegría, o compañía gringolandesa.'), (8, 'Coca Cola', '18-10-2015', '22:3:19', '18-10-2015', '22:3:19', 200, 'Compañía que fabrica bebidas, y que no nos paga por ponerla en py-test :c.'), (9, 'Pepsi', '18-10-2015', '22:3:40', '18-10-2015', '22:3:40', 340, 'Competidora de la anterior compañía mencionada, y que tampoco nos paga :c.'), (10, 'GitHub', '18-10-2015', '22:4:42', '18-10-2015', '22:4:42', 563423, 'Plataforma de gestión de co0o0o0ó0digo.'), (11, 'Johnny Walker', '18-10-2015', '22:5:34', '18-10-2015', '22:5:34', 4252, 'Whisky escocés.'), (12, 'Mercury', '18-10-2015', '22:5:51', '18-10-2015', '22:5:51', 23423, 'Fabricante de motores fuera de borda.'), (13, 'Rolls Royce', '18-10-2015', '22:6:7', '18-10-2015', '22:6:7', 75832, 'Fabricante de motores para aviones, y autos de alta gama.')]
66+
color_recordset = [(1, 'Feisbuk', '\x1b[1;32m18-10-2015\x1b[0;39m', '21:57:17', '\x1b[1;32m18-10-2015\x1b[0;39m', '21:57:17', 1234, 'Social network bla bla bla used by people bla bla.'), (2, 'Gugle', '\x1b[1;32m18-10-2015\x1b[0;39m', '21:57:44', '\x1b[1;32m18-10-2015\x1b[0;39m', '21:57:44', 12323, 'Search engine that categorize results using an algorithm that bla bla bla.'), (3, 'Opera', '\x1b[1;32m18-10-2015\x1b[0;39m', '21:58:39', '\x1b[1;32m18-10-2015\x1b[0;39m', '21:58:39', 4324, 'Navegador de internerd, también es una disciplina musical, que, valga la redundancia, requiere de una brutal disciplina por parte de los interpretes.'), (4, 'Audi', '\x1b[1;32m18-10-2015\x1b[0;39m', '21:59:51', '\x1b[1;32m18-10-2015\x1b[0;39m', '21:59:51', 0, 'OOOO <-- Fabricante alemán de vehiculos de alta gama.'), (5, 'The Simpsons', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:0:44', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:0:44', 0, 'Una sitcom que lleva veintipico de temporadas, si no la viste, se puede presumir que vivís bajo una piedra.'), (6, 'BMW', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:1:18', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:1:18', 98765, 'Fabricante alemán de autos de lujo.'), (7, 'Yahoo', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:1:56', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:1:56', 53430, 'Expresión de alegría, o compañía gringolandesa.'), (8, 'Coca Cola', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:3:19', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:3:19', 200, 'Compañía que fabrica bebidas, y que no nos paga por ponerla en py-test :c.'), (9, 'Pepsi', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:3:40', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:3:40', 340, 'Competidora de la anterior compañía mencionada, y que tampoco nos paga :c.'), (10, 'GitHub', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:4:42', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:4:42', 563423, 'Plataforma de gestión de co0o0o0ó0digo.'), (11, 'Johnny Walker', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:5:34', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:5:34', 4252, 'Whisky escocés.'), (12, 'Mercury', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:5:51', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:5:51', 23423, 'Fabricante de motores fuera de borda.'), (13, 'Rolls Royce', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:6:7', '\x1b[1;32m18-10-2015\x1b[0;39m', '22:6:7', 75832, 'Fabricante de motores para aviones, y autos de alta gama.')]
5767

5868
# Test included with Outfancy.
5969
def test():
@@ -73,6 +83,16 @@ def test_table():
7383
create_motors()
7484
print(motor.render(recordset))
7585

86+
# Test table with_colors.
87+
def test_table_with_colors():
88+
print('>>> import outfancy')
89+
print('>>> motor = outfancy.render.Table()')
90+
print('>>> color_recordset =', color_recordset)
91+
print('>>> print(motor.render(color_recordset))')
92+
sleep(2)
93+
create_motors()
94+
print(motor.render(color_recordset))
95+
7696
# Test of an Oneline object.
7797
def test_oneline():
7898
print('>>> import outfancy')

0 commit comments

Comments
 (0)