|
18 | 18 | import numpy as np |
19 | 19 | import pytest |
20 | 20 |
|
21 | | -from tunits.core import raw_WithUnit, raw_UnitArray, WithUnit |
| 21 | +from tunits.core import raw_WithUnit, raw_UnitArray, WithUnit, NotTUnitsLikeError |
22 | 22 |
|
23 | 23 | from tunits import UnitMismatchError, ValueArray, Value |
24 | 24 | from test.test_utils import frac, conv, val |
@@ -85,7 +85,6 @@ def test_abs() -> None: |
85 | 85 |
|
86 | 86 | def test_equality() -> None: |
87 | 87 | equivalence_groups: list[list[Any]] = [ |
88 | | - [""], |
89 | 88 | ["other types"], |
90 | 89 | [list], |
91 | 90 | [None], |
@@ -488,21 +487,11 @@ def test_get_item() -> None: |
488 | 487 | v = val(2, conv(numer=3, denom=5, exp10=7), mps, kph) |
489 | 488 |
|
490 | 489 | # Wrong kinds of index (unit array, slice). |
491 | | - with pytest.raises(TypeError): |
| 490 | + with pytest.raises(UnitMismatchError): |
492 | 491 | _ = u[mps] |
493 | | - with pytest.raises(TypeError): |
| 492 | + with pytest.raises(NotTUnitsLikeError): |
494 | 493 | _ = u[1:2] |
495 | 494 |
|
496 | | - # Safety against dimensionless unit ambiguity. |
497 | | - _ = u[u] |
498 | | - with pytest.raises(TypeError): |
499 | | - _ = u[1.0] |
500 | | - with pytest.raises(TypeError): |
501 | | - _ = u[1.0] |
502 | | - with pytest.raises(TypeError): |
503 | | - _ = u[1] |
504 | | - with pytest.raises(TypeError): |
505 | | - _ = u[2 * v / v] |
506 | 495 | assert u[v / v] == 10 |
507 | 496 |
|
508 | 497 | # Wrong unit. |
|
0 commit comments