@@ -8,14 +8,12 @@ def test_list(self):
88 assert Bit ([True , False , True ]).to_list () == [True , False , True ]
99
1010 def test_list_none (self ):
11- with pytest .raises (ValueError ) as error :
12- Bit ([True , None , True ])
13- assert str (error .value ) == 'expected all elements to be boolean'
11+ with pytest .warns (UserWarning , match = 'expected elements to be boolean' ):
12+ assert Bit ([True , None , True ]).to_text () == '101'
1413
1514 def test_list_int (self ):
16- with pytest .raises (ValueError ) as error :
17- Bit ([254 , 7 , 0 ])
18- assert str (error .value ) == 'expected all elements to be boolean'
15+ with pytest .warns (UserWarning , match = 'expected elements to be boolean' ):
16+ assert Bit ([254 , 7 , 0 ]).to_text () == '110'
1917
2018 def test_tuple (self ):
2119 assert Bit ((True , False , True )).to_list () == [True , False , True ]
@@ -29,13 +27,13 @@ def test_bytes(self):
2927
3028 def test_ndarray_uint8 (self ):
3129 arr = np .array ([254 , 7 , 0 ], dtype = np .uint8 )
32- assert Bit (arr ).to_text () == '111111100000011100000000'
30+ with pytest .warns (UserWarning , match = 'expected elements to be boolean' ):
31+ assert Bit (arr ).to_text () == '110'
3332
3433 def test_ndarray_uint16 (self ):
3534 arr = np .array ([254 , 7 , 0 ], dtype = np .uint16 )
36- with pytest .raises (ValueError ) as error :
37- Bit (arr )
38- assert str (error .value ) == 'expected dtype to be bool or uint8'
35+ with pytest .warns (UserWarning , match = 'expected elements to be boolean' ):
36+ assert Bit (arr ).to_text () == '110'
3937
4038 def test_ndarray_same_object (self ):
4139 arr = np .array ([True , False , True ])
0 commit comments