Skip to content

Commit

Permalink
fix: reinstated type checking now hierarchy in place
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelm committed Mar 29, 2022
1 parent faf3b1b commit 6f99654
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
8 changes: 4 additions & 4 deletions broadworks_ocip/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def __init__(self, **kwargs):
raise TypeError(
f"{cname}: Expected {elem.name} to be a table/list but it is {type(value)}",
)
# elif not isinstance(value, elem.type):
# raise TypeError(
# f"{cname}: Expected {elem.name} to be type {elem.type} but it is {type(value)}",
# )
elif not isinstance(value, elem.type):
raise TypeError(
f"{cname}: Expected {elem.name} to be type {elem.type} but it is {type(value)}",
)
setattr(self, elem.name, value)
del kwargs[elem.name]
elif elem.is_required:
Expand Down
5 changes: 0 additions & 5 deletions tests/test_faulty_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def test_working_base(self):
assert cmd is not None
assert "GroupAccessDeviceAddRequest14" in str(type(cmd))

@pytest.mark.xfail
def test_unexpected_list(self):
with pytest.raises(TypeError):
api.get_command_object(
Expand All @@ -54,7 +53,6 @@ def test_unexpected_list(self):
],
)

@pytest.mark.xfail
def test_not_a_bool(self):
with pytest.raises(TypeError):
api.get_command_object(
Expand All @@ -73,7 +71,6 @@ def test_not_a_bool(self):
),
)

@pytest.mark.xfail
def test_unexpected_bool(self):
with pytest.raises(TypeError):
api.get_command_object(
Expand All @@ -92,7 +89,6 @@ def test_unexpected_bool(self):
),
)

@pytest.mark.xfail
def test_too_many_things(self):
with pytest.raises(TypeError):
api.get_command_object(
Expand Down Expand Up @@ -242,7 +238,6 @@ def test_group_missing_attribute(self):
),
)

@pytest.mark.xfail # we do not check for this yet
def test_department_key_type(self):
cmd = api.get_command_object(
"UserModifyRequest16",
Expand Down

0 comments on commit 6f99654

Please sign in to comment.