Skip to content

Commit

Permalink
Add read_unsopported_type test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Ruiz committed Jun 17, 2022
1 parent 1b93309 commit 308396a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/test_mmio.py
Expand Up @@ -183,6 +183,15 @@ def test_reg_read_float(mmap_device):
assert np.isclose(read, testdata, rtol=1e-05, atol=1e-08, equal_nan=False)


def test_reg_read_unsopported_type(mmap_device):
device = mmap_device
mmio = pynq.MMIO(BASE_ADDRESS, ADDR_RANGE, device=device)
offset, value = (956, np.float16(102.687))
with pytest.raises(ValueError) as excinfo:
read = mmio.read(offset, dtype=type(value))
assert str(excinfo.value) == "dtype \'{}\' is not supported".format(type(value))


def test_reg_write_unsupported_type(mmap_device):
device = mmap_device
mmio = pynq.MMIO(BASE_ADDRESS, ADDR_RANGE, device=device)
Expand Down Expand Up @@ -238,4 +247,4 @@ def test_deprecated_word_order_keyword(mmap_device):
assert issubclass(w[-1].category, DeprecationWarning), \
'Warning is not of type DeprecationWarning'
assert "word_order" in str(w[-1].message), \
'Keyword word_order has been deprecated.'
'Keyword word_order has been deprecated.'

0 comments on commit 308396a

Please sign in to comment.