|
8 | 8 |
|
9 | 9 |
|
10 | 10 | class TestBit: |
| 11 | + @pytest.mark.skipif(np is None, reason='NumPy required') |
11 | 12 | def test_list(self): |
12 | 13 | assert Bit([True, False, True]).to_list() == [True, False, True] |
13 | 14 |
|
| 15 | + @pytest.mark.skipif(np is None, reason='NumPy required') |
14 | 16 | def test_list_none(self): |
15 | 17 | with pytest.warns(UserWarning, match='expected elements to be boolean'): |
16 | 18 | assert Bit([True, None, True]).to_text() == '101' # ty: ignore[invalid-argument-type] |
17 | 19 |
|
| 20 | + @pytest.mark.skipif(np is None, reason='NumPy required') |
18 | 21 | def test_list_int(self): |
19 | 22 | with pytest.warns(UserWarning, match='expected elements to be boolean'): |
20 | 23 | assert Bit([254, 7, 0]).to_text() == '110' # ty: ignore[invalid-argument-type] |
21 | 24 |
|
| 25 | + @pytest.mark.skipif(np is None, reason='NumPy required') |
22 | 26 | def test_str(self): |
23 | 27 | assert Bit('101').to_list() == [True, False, True] |
24 | 28 |
|
@@ -49,20 +53,24 @@ def test_ndarray_uint16(self): |
49 | 53 | with pytest.warns(UserWarning, match='expected elements to be boolean'): |
50 | 54 | assert Bit(arr).to_text() == '110' |
51 | 55 |
|
| 56 | + @pytest.mark.skipif(np is None, reason='NumPy required') |
52 | 57 | def test_ndim_two(self): |
53 | 58 | with pytest.raises(ValueError) as error: |
54 | 59 | Bit([[True, False], [True, False]]) # ty: ignore[invalid-argument-type] |
55 | 60 | assert str(error.value) == 'expected ndim to be 1' |
56 | 61 |
|
| 62 | + @pytest.mark.skipif(np is None, reason='NumPy required') |
57 | 63 | def test_ndim_zero(self): |
58 | 64 | with pytest.raises(ValueError) as error: |
59 | 65 | Bit(True) # ty: ignore[invalid-argument-type] |
60 | 66 | assert str(error.value) == 'expected ndim to be 1' |
61 | 67 |
|
| 68 | + @pytest.mark.skipif(np is None, reason='NumPy required') |
62 | 69 | def test_repr(self): |
63 | 70 | assert repr(Bit([True, False, True])) == 'Bit(101)' |
64 | 71 | assert str(Bit([True, False, True])) == 'Bit(101)' |
65 | 72 |
|
| 73 | + @pytest.mark.skipif(np is None, reason='NumPy required') |
66 | 74 | def test_equality(self): |
67 | 75 | assert Bit([True, False, True]) == Bit([True, False, True]) |
68 | 76 | assert Bit([True, False, True]) != Bit([True, False, False]) |
0 commit comments