Skip to content

Commit

Permalink
Modify tests for better code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
samantha-ho committed Nov 8, 2024
1 parent 64f93dc commit da2d5f4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/extensions/test_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,15 @@ def test_sole_chain_link_of_type():
user_link_2 = UserLinkingParameter("user_link_2", linked_parameter=delegate_link)

InferAttrs.add("linked_parameter")
user_links = get_chain_links_of_type(UserLinkingParameter, delegate_link)
assert set(user_links) == set([user_link])
sole_user_link = get_sole_chain_link_of_type(UserLinkingParameter, delegate_link)
assert sole_user_link == user_link

with pytest.raises(ValueError) as exc_info:
user_links = get_sole_chain_link_of_type(UserLinkingParameter, user_link_2)
_ = get_sole_chain_link_of_type(UserLinkingParameter, user_link_2)
assert "Expected only a single chain link of type" in str(exc_info.value)

with pytest.raises(ValueError) as exc_info:
_ = get_sole_chain_link_of_type(
(UserLinkingParameter, DelegateParameter), user_link_2
)
assert "Expected only a single chain link of types" in str(exc_info.value)

0 comments on commit da2d5f4

Please sign in to comment.