|
10 | 10 | from pydicom.uid import UID |
11 | 11 |
|
12 | 12 | from pynetdicom import AE, _config |
13 | | -from pynetdicom._globals import DEFAULT_TRANSFER_SYNTAXES |
| 13 | +from pynetdicom._globals import DEFAULT_TRANSFER_SYNTAXES, ALL_TRANSFER_SYNTAXES |
14 | 14 | from pynetdicom.pdu_primitives import SCP_SCU_RoleSelectionNegotiation |
15 | 15 | from pynetdicom.presentation import ( |
16 | 16 | build_context, |
@@ -126,7 +126,7 @@ def test_add_transfer_syntax_nonconformant(self, caplog): |
126 | 126 |
|
127 | 127 | pc.add_transfer_syntax("1.2.840.10008.1.1") |
128 | 128 | assert ( |
129 | | - "A UID has been added to 'transfer_syntax' that is not a " |
| 129 | + "A UID has been added to 'transfer_syntax' that is not a known public " |
130 | 130 | "transfer syntax" in caplog.text |
131 | 131 | ) |
132 | 132 |
|
@@ -295,11 +295,12 @@ def test_abstract_syntax_nonconformant(self, caplog): |
295 | 295 | msg = "Invalid 'abstract_syntax' value '1.4.1.' - UID is non-conformant" |
296 | 296 | with pytest.raises(ValueError, match=msg): |
297 | 297 | pc.abstract_syntax = UID("1.4.1.") |
| 298 | + |
298 | 299 | assert pc.abstract_syntax is None |
299 | 300 |
|
300 | 301 | _config.ENFORCE_UID_CONFORMANCE = False |
301 | | - pc.abstract_syntax = UID("1.4.1.") |
302 | 302 |
|
| 303 | + pc.abstract_syntax = UID("1.4.1.") |
303 | 304 | assert pc.abstract_syntax == UID("1.4.1.") |
304 | 305 | assert isinstance(pc.abstract_syntax, UID) |
305 | 306 |
|
@@ -433,6 +434,18 @@ def test_repr(self): |
433 | 434 | cx = build_context("1.2.840.10008.1.1") |
434 | 435 | assert "Verification SOP Class" == repr(cx) |
435 | 436 |
|
| 437 | + def test_transfer_syntaxes_dont_warn(self, caplog): |
| 438 | + """Test that all transfer syntaxes are known to pydicom""" |
| 439 | + caplog.set_level(logging.WARNING, logger="pynetdicom.presentation") |
| 440 | + for ts in ALL_TRANSFER_SYNTAXES: |
| 441 | + cx = build_context("1.2.3", ts) |
| 442 | + |
| 443 | + for ts in DEFAULT_TRANSFER_SYNTAXES: |
| 444 | + cx = build_context("1.2.3", ts) |
| 445 | + |
| 446 | + assert caplog.text == "" |
| 447 | + |
| 448 | + |
436 | 449 |
|
437 | 450 | class TestNegotiateAsAcceptor: |
438 | 451 | """Tests negotiation_as_acceptor.""" |
|
0 commit comments