Skip to content

Commit

Permalink
Remove warning tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scaramallion committed Nov 8, 2023
1 parent a95a088 commit f4b6aa1
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions pynetdicom/tests/test_presentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ def test_add_transfer_syntax_nonconformant(self, caplog):

msg = r"'transfer_syntax' contains an invalid UID"
with pytest.raises(ValueError, match=msg):
with pytest.warns(UserWarning, match="Invalid value for VR UI"):
pc.add_transfer_syntax("1.2.3.")
pc.add_transfer_syntax("1.2.3.")

assert msg in caplog.text

Expand All @@ -130,8 +129,7 @@ def test_add_transfer_syntax_nonconformant(self, caplog):
)

_config.ENFORCE_UID_CONFORMANCE = False
with pytest.warns(UserWarning, match="Invalid value for VR UI"):
pc.add_transfer_syntax("1.2.3.")
pc.add_transfer_syntax("1.2.3.")
assert "1.2.3." in pc.transfer_syntax

def test_add_private_transfer_syntax(self):
Expand Down Expand Up @@ -294,16 +292,13 @@ def test_abstract_syntax_nonconformant(self, caplog):

msg = "Invalid 'abstract_syntax' value '1.4.1.' - UID is non-conformant"
with pytest.raises(ValueError, match=msg):
with pytest.warns(UserWarning, match="Invalid value for VR UI"):
pc.abstract_syntax = UID("1.4.1.")
pc.abstract_syntax = UID("1.4.1.")
assert pc.abstract_syntax is None

_config.ENFORCE_UID_CONFORMANCE = False
with pytest.warns(UserWarning, match="Invalid value for VR UI"):
pc.abstract_syntax = UID("1.4.1.")
pc.abstract_syntax = UID("1.4.1.")

with pytest.warns(UserWarning, match="Invalid value for VR UI"):
assert pc.abstract_syntax == UID("1.4.1.")
assert pc.abstract_syntax == UID("1.4.1.")
assert isinstance(pc.abstract_syntax, UID)

assert msg in caplog.text
Expand Down Expand Up @@ -340,8 +335,7 @@ def test_transfer_syntax_nonconformant(self, caplog):
caplog.set_level(logging.DEBUG, logger="pynetdicom.presentation")
pc = PresentationContext()
pc.context_id = 1
with pytest.warns(UserWarning, match="Invalid value for VR UI"):
pc.transfer_syntax = ["1.4.1.", "1.2.840.10008.1.2"]
pc.transfer_syntax = ["1.4.1.", "1.2.840.10008.1.2"]

assert pc.transfer_syntax == ["1.4.1.", "1.2.840.10008.1.2"]
assert "A non-conformant UID has been added to 'transfer_syntax'" in caplog.text
Expand Down

0 comments on commit f4b6aa1

Please sign in to comment.