@@ -824,28 +824,41 @@ def test_align_right_wide_fill_needs_padding():
824824 assert aligned == fill_char + ' ' + text
825825
826826
827- def test_str_to_bool_true ():
828- assert cu .str_to_bool ('true' )
829- assert cu .str_to_bool ('True' )
830- assert cu .str_to_bool ('TRUE' )
831- assert cu .str_to_bool ('tRuE' )
827+ def test_to_bool_str_true ():
828+ assert cu .to_bool ('true' )
829+ assert cu .to_bool ('True' )
830+ assert cu .to_bool ('TRUE' )
831+ assert cu .to_bool ('tRuE' )
832832
833833
834- def test_str_to_bool_false ():
835- assert not cu .str_to_bool ('false' )
836- assert not cu .str_to_bool ('False' )
837- assert not cu .str_to_bool ('FALSE' )
838- assert not cu .str_to_bool ('fAlSe' )
834+ def test_to_bool_str_false ():
835+ assert not cu .to_bool ('false' )
836+ assert not cu .to_bool ('False' )
837+ assert not cu .to_bool ('FALSE' )
838+ assert not cu .to_bool ('fAlSe' )
839839
840840
841- def test_str_to_bool_invalid ():
841+ def test_to_bool_str_invalid ():
842842 with pytest .raises (ValueError ):
843- cu .str_to_bool ('other' )
843+ cu .to_bool ('other' )
844844
845845
846- def test_str_to_bool_bad_input ():
847- with pytest .raises (ValueError ):
848- cu .str_to_bool (1 )
846+ def test_to_bool_bool ():
847+ assert cu .to_bool (True )
848+ assert not cu .to_bool (False )
849+
850+
851+ def test_to_bool_int ():
852+ assert cu .to_bool (1 )
853+ assert cu .to_bool (- 1 )
854+ assert not cu .to_bool (0 )
855+
856+
857+ def test_to_bool_float ():
858+ assert cu .to_bool (2.35 )
859+ assert cu .to_bool (0.25 )
860+ assert cu .to_bool (- 3.1415 )
861+ assert not cu .to_bool (0 )
849862
850863
851864def test_find_editor_specified ():
0 commit comments