mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2024-11-12 17:54:29 +00:00
fix string checking in raised asserts
This commit is contained in:
parent
a1a440e6ad
commit
fd252e3911
2 changed files with 10 additions and 8 deletions
|
@ -115,7 +115,7 @@ class Interface(ABC, Generic[T]):
|
|||
Convert an array of :attr:`.return_type` to a JSON-compatible format using
|
||||
base python types
|
||||
"""
|
||||
if not isinstance(array, np.ndarray):
|
||||
if not isinstance(array, np.ndarray): # pragma: no cover
|
||||
array = np.array(array)
|
||||
return array.tolist()
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import pdb
|
||||
|
||||
import pytest
|
||||
|
||||
import numpy as np
|
||||
|
@ -47,21 +49,21 @@ def test_interface_match_error(interfaces):
|
|||
"""
|
||||
with pytest.raises(ValueError) as e:
|
||||
Interface.match([1, 2, 3])
|
||||
assert "Interface1" in e
|
||||
assert "Interface2" in e
|
||||
assert "Interface1" in str(e.value)
|
||||
assert "Interface2" in str(e.value)
|
||||
|
||||
with pytest.raises(ValueError) as e:
|
||||
Interface.match([[1, 2, 3], ["hey"]])
|
||||
assert "No matching interfaces" in e
|
||||
Interface.match(([1, 2, 3], ["hey"]))
|
||||
assert "No matching interfaces" in str(e.value)
|
||||
|
||||
with pytest.raises(ValueError) as e:
|
||||
Interface.match_output((1, 2, 3))
|
||||
assert "Interface1" in e
|
||||
assert "Interface2" in e
|
||||
assert "Interface1" in str(e.value)
|
||||
assert "Interface2" in str(e.value)
|
||||
|
||||
with pytest.raises(ValueError) as e:
|
||||
Interface.match_output("hey")
|
||||
assert "No matching interfaces" in e
|
||||
assert "No matching interfaces" in str(e.value)
|
||||
|
||||
|
||||
def test_interface_enabled(interfaces):
|
||||
|
|
Loading…
Reference in a new issue