@@ -153,31 +153,24 @@ def test_fail_getime():
153153 pytest .raises (ValueError , Cycler .__getitem__ , c1 , [0 , 1 ])
154154
155155
156- def _repr_tester_helper (rpr_func , cyc , target_repr ):
157- test_repr = getattr (cyc , rpr_func )()
158-
159- assert str (test_repr ) == str (target_repr )
160-
161-
162156def test_repr ():
163157 c = cycler (c = 'rgb' )
164158 # Using an identifier that would be not valid as a kwarg
165159 c2 = cycler ('3rd' , range (3 ))
166160
167- c_sum_rpr = "(cycler('c', ['r', 'g', 'b']) + cycler('3rd', [0, 1, 2]))"
168- c_prod_rpr = "(cycler('c', ['r', 'g', 'b']) * cycler('3rd', [0, 1, 2]))"
169-
170- _repr_tester_helper ('__repr__' , c + c2 , c_sum_rpr )
171- _repr_tester_helper ('__repr__' , c * c2 , c_prod_rpr )
161+ assert repr (c + c2 ) == (
162+ "(cycler('c', ['r', 'g', 'b']) + cycler('3rd', [0, 1, 2]))" )
163+ assert repr (c * c2 ) == (
164+ "(cycler('c', ['r', 'g', 'b']) * cycler('3rd', [0, 1, 2]))" )
172165
173- sum_html = (
166+ assert ( c + c2 ). _repr_html_ () = = (
174167 "<table>"
175168 "<th>'3rd'</th><th>'c'</th>"
176169 "<tr><td>0</td><td>'r'</td></tr>"
177170 "<tr><td>1</td><td>'g'</td></tr>"
178171 "<tr><td>2</td><td>'b'</td></tr>"
179172 "</table>" )
180- prod_html = (
173+ assert ( c * c2 ). _repr_html_ () = = (
181174 "<table>"
182175 "<th>'3rd'</th><th>'c'</th>"
183176 "<tr><td>0</td><td>'r'</td></tr>"
@@ -191,9 +184,6 @@ def test_repr():
191184 "<tr><td>2</td><td>'b'</td></tr>"
192185 "</table>" )
193186
194- _repr_tester_helper ('_repr_html_' , c + c2 , sum_html )
195- _repr_tester_helper ('_repr_html_' , c * c2 , prod_html )
196-
197187
198188def test_call ():
199189 c = cycler (c = 'rgb' )
@@ -276,27 +266,20 @@ def test_keychange():
276266 pytest .raises (KeyError , Cycler .change_key , c , 'c' , 'foobar' )
277267
278268
279- def _eq_test_helper (a , b , res ):
280- if res :
281- assert a == b
282- else :
283- assert a != b
284-
285-
286269def test_eq ():
287270 a = cycler (c = 'rgb' )
288271 b = cycler (c = 'rgb' )
289- _eq_test_helper ( a , b , True )
290- _eq_test_helper ( a , b [::- 1 ], False )
272+ assert a == b
273+ assert a != b [::- 1 ]
291274 c = cycler (lw = range (3 ))
292- _eq_test_helper ( a + c , c + a , True )
293- _eq_test_helper ( a + c , c + b , True )
294- _eq_test_helper ( a * c , c * a , False )
295- _eq_test_helper ( a , c , False )
275+ assert a + c == c + a
276+ assert a + c == c + b
277+ assert a * c != c * a
278+ assert a != c
296279 d = cycler (c = 'ymk' )
297- _eq_test_helper ( b , d , False )
280+ assert b != d
298281 e = cycler (c = 'orange' )
299- _eq_test_helper ( b , e , False )
282+ assert b != e
300283
301284
302285def test_cycler_exceptions ():
0 commit comments