@@ -824,28 +824,41 @@ def test_align_right_wide_fill_needs_padding():
824
824
assert aligned == fill_char + ' ' + text
825
825
826
826
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' )
832
832
833
833
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' )
839
839
840
840
841
- def test_str_to_bool_invalid ():
841
+ def test_to_bool_str_invalid ():
842
842
with pytest .raises (ValueError ):
843
- cu .str_to_bool ('other' )
843
+ cu .to_bool ('other' )
844
844
845
845
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 )
849
862
850
863
851
864
def test_find_editor_specified ():
0 commit comments