10
10
import cheat .printer as cp
11
11
import cheat .utils as u
12
12
13
+
13
14
class PrinterTest (unittest .TestCase ):
14
15
"""
15
16
Some basic tests to check the Printer classes.
@@ -22,7 +23,7 @@ def setUp(self):
22
23
"""
23
24
24
25
directory = os .path .dirname (os .path .realpath (__file__ ))
25
- testfile = os .path .join (directory , "test.ini" )
26
+ testfile = os .path .join (directory , "testsheets" , " test.ini" )
26
27
self .cparser = ConfigParser ()
27
28
self .cparser .read (testfile )
28
29
@@ -67,7 +68,7 @@ def test_InlinePrinter_colored(self):
67
68
68
69
expected_output = lines [0 ] + lines [1 ] + lines [2 ]
69
70
70
- printer = cp .InlinePrinter (self .cparser , u .colors , print_colored = True )
71
+ printer = cp .InlinePrinter (self .cparser , u .Colors , print_colored = True )
71
72
72
73
with patch ('sys.stdout' , new = StringIO ()) as fake_out :
73
74
printer .printsheet ()
@@ -86,7 +87,7 @@ def test_InlinePrinter(self):
86
87
87
88
expected_output = lines [0 ] + lines [1 ] + lines [2 ]
88
89
89
- printer = cp .InlinePrinter (self .cparser , u .colors , print_colored = False )
90
+ printer = cp .InlinePrinter (self .cparser , u .Colors , print_colored = False )
90
91
91
92
with patch ('sys.stdout' , new = StringIO ()) as fake_out :
92
93
printer .printsheet ()
@@ -97,7 +98,7 @@ def test_InlinePrinter_width(self):
97
98
Test to see if the calculated width is correct.
98
99
"""
99
100
100
- printer = cp .InlinePrinter (self .cparser , u .colors , print_colored = False )
101
+ printer = cp .InlinePrinter (self .cparser , u .Colors , print_colored = False )
101
102
102
103
expected_length = str (len ('Test Cheat A' ))
103
104
self .assertEqual (printer .width , expected_length )
@@ -114,7 +115,7 @@ def test_BreaklinePrinter(self):
114
115
115
116
expected_output = lines [0 ] + lines [1 ] + lines [2 ]
116
117
117
- printer = cp .BreaklinePrinter (self .cparser , u .colors , print_colored = False )
118
+ printer = cp .BreaklinePrinter (self .cparser , u .Colors , print_colored = False )
118
119
119
120
with patch ('sys.stdout' , new = StringIO ()) as fake_out :
120
121
printer .printsheet ()
@@ -132,9 +133,9 @@ def test_Printer_printsheet(self):
132
133
133
134
expected_output = lines [0 ] + lines [1 ] + lines [2 ]
134
135
135
- printer = cp .Printer (self .cparser , u .colors )
136
+ printer = cp .Printer (self .cparser , u .Colors )
136
137
template = "{0}"
137
138
138
139
with patch ('sys.stdout' , new = StringIO ()) as fake_out :
139
- printer .printsheet (template )
140
+ printer .printcheats (template )
140
141
self .assertEqual (fake_out .getvalue (), expected_output )
0 commit comments