File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,11 @@ def __init__(self, value):
7
7
if isinstance (value , str ):
8
8
self ._value = self .from_text (value )._value
9
9
else :
10
- # TODO change in 0.4.0
11
10
# TODO raise if dtype not bool or uint8
12
- # if isinstance(value, np.ndarray) and value.dtype == np.uint8:
13
- # value = np.unpackbits(value)
14
- # else:
15
- # value = np.asarray(value, dtype=bool)
16
-
17
- value = np .asarray (value , dtype = bool )
11
+ if isinstance (value , np .ndarray ) and value .dtype == np .uint8 :
12
+ value = np .unpackbits (value )
13
+ else :
14
+ value = np .asarray (value , dtype = bool )
18
15
19
16
if value .ndim != 1 :
20
17
raise ValueError ('expected ndim to be 1' )
Original file line number Diff line number Diff line change @@ -15,9 +15,7 @@ def test_str(self):
15
15
16
16
def test_ndarray_uint8 (self ):
17
17
arr = np .array ([254 , 7 , 0 ], dtype = np .uint8 )
18
- # TODO change in 0.4.0
19
- # assert Bit(arr).to_text() == '111111100000011100000000'
20
- assert Bit (arr ).to_text () == '110'
18
+ assert Bit (arr ).to_text () == '111111100000011100000000'
21
19
22
20
def test_ndarray_same_object (self ):
23
21
arr = np .array ([True , False , True ])
You can’t perform that action at this time.
0 commit comments