@@ -107,3 +107,60 @@ def test_footer():
107107 "╚═════╩═══════════════════════╝\n "
108108 )
109109 assert text == expected
110+
111+
112+ def test_header_footer_unequal ():
113+ with pytest .raises (ValueError ):
114+ t2a (
115+ header = ["H" , "R" , "S" ],
116+ footer = ["SUM" , "130" , "140" , "135" , "130" ],
117+ )
118+
119+
120+ def test_header_body_unequal ():
121+ with pytest .raises (ValueError ):
122+ t2a (
123+ header = ["#" , "G" , "H" , "R" , "S" ],
124+ body = [
125+ ["0" , "45" , "30" , "32" , "28" ],
126+ ["1" , "30" , "40" , "35" , "30" , "36" ],
127+ ["2" , "30" , "40" , "35" , "30" ],
128+ ],
129+ )
130+
131+
132+ def test_footer_body_unequal ():
133+ with pytest .raises (ValueError ):
134+ t2a (
135+ body = [
136+ ["0" , "45" , "30" , "32" , "28" ],
137+ ["1" , "30" , "40" , "35" , "30" ],
138+ ["2" , "30" , "40" , "35" , "30" ],
139+ ],
140+ footer = ["SUM" , "130" , "140" , "135" , "130" , "36" ],
141+ )
142+
143+
144+ def test_empty_header ():
145+ text = t2a (
146+ header = [],
147+ body = [["1" , "30" , "40" , "35" , "30" ], ["2" , "30" , "40" , "35" , "30" ]],
148+ )
149+ expected = (
150+ "╔═══╦═══════════════════╗\n "
151+ "║ 1 ║ 30 40 35 30 ║\n "
152+ "║ 2 ║ 30 40 35 30 ║\n "
153+ "╚═══╩═══════════════════╝\n "
154+ )
155+ assert text == expected
156+
157+
158+ def test_empty_body ():
159+ text = t2a (header = ["#" , "G" , "H" , "R" , "S" ], body = [])
160+ expected = (
161+ "╔═══╦═══════════════╗\n "
162+ "║ # ║ G H R S ║\n "
163+ "╟───╫───────────────╢\n "
164+ "╚═══╩═══════════════╝\n "
165+ )
166+ assert text == expected
0 commit comments