Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Fix AttributeError tests for Python 3.11 #754

Merged
merged 1 commit into from Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 14 additions & 14 deletions pynetdicom/tests/test_assoc_user.py
Expand Up @@ -164,7 +164,7 @@ def test_mode_assignment_raises(self):
"""Test that assigning mode after init raises exception."""
user = ServiceUser(self.assoc, mode="acceptor")
assert user.mode == "acceptor"
with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.mode = "requestor"

assert user.mode == "acceptor"
Expand Down Expand Up @@ -297,22 +297,22 @@ def test_primitive_assignment_raises(self):
with pytest.raises(RuntimeError, match=msg):
user.implementation_version_name = "1.2.3"

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.asynchronous_operations = (1, 1)

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.role_selection = {}

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.sop_class_common_extended = {}

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.sop_class_extended = {}

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.user_identity = "test"

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.extended_negotiation = []

def test_add_neg_pre(self):
Expand Down Expand Up @@ -1477,7 +1477,7 @@ def test_mode_assignment_raises(self):
"""Test that assigning mode after init raises exception."""
user = ServiceUser(self.assoc, mode="requestor")
assert user.mode == "requestor"
with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.mode = "acceptor"

assert user.mode == "requestor"
Expand Down Expand Up @@ -1601,22 +1601,22 @@ def test_primitive_assignment_raises(self):
with pytest.raises(RuntimeError, match=msg):
user.implementation_version_name = "1.2.3"

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.asynchronous_operations = (1, 1)

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.role_selection = {}

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.sop_class_common_extended = {}

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.sop_class_extended = {}

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.user_identity = "test"

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
user.extended_negotiation = []

def test_accepted_common_raises(self):
Expand Down
4 changes: 2 additions & 2 deletions pynetdicom/tests/test_presentation.py
Expand Up @@ -374,7 +374,7 @@ def test_as_scp(self):
context = build_context("1.2.3")
assert context.as_scp is None

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
context.as_scp = True

context._as_scp = True
Expand All @@ -387,7 +387,7 @@ def test_as_scu(self):
context = build_context("1.2.3")
assert context.as_scu is None

with pytest.raises(AttributeError, match=r"can't set attribute"):
with pytest.raises(AttributeError, match=r"can't set attribute|has no setter"):
context.as_scu = True

context._as_scu = True
Expand Down