Example #1
0
    def test_add_private_transfer_syntax(self):
        """Test adding private transfer syntaxes"""
        pc = PresentationContext(1)
        pc.add_transfer_syntax('2.16.840.1.113709.1.2.2')
        self.assertTrue('2.16.840.1.113709.1.2.2' in pc._transfer_syntax)

        pc.TransferSyntax = ['2.16.840.1.113709.1.2.1']
        self.assertTrue('2.16.840.1.113709.1.2.1' in pc._transfer_syntax)
Example #2
0
    def test_transfer_syntax(self):
        """Test transfer syntax setter"""
        pc = PresentationContext(1)
        pc.TransferSyntax = ['1.2.840.10008.1.2']
        self.assertEqual(pc.TransferSyntax[0], UID('1.2.840.10008.1.2'))
        self.assertTrue(isinstance(pc.TransferSyntax[0], UID))
        pc.TransferSyntax = [b'1.2.840.10008.1.2.1']
        self.assertEqual(pc.TransferSyntax[0], UID('1.2.840.10008.1.2.1'))
        self.assertTrue(isinstance(pc.TransferSyntax[0], UID))
        pc.TransferSyntax = [UID('1.2.840.10008.1.2.2')]
        self.assertEqual(pc.TransferSyntax[0], UID('1.2.840.10008.1.2.2'))
        self.assertTrue(isinstance(pc.TransferSyntax[0], UID))

        with self.assertRaises(TypeError):
            pc.TransferSyntax = UID('1.4.1')

        pc.TransferSyntax = ['1.4.1.', '1.2.840.10008.1.2']
        self.assertEqual(pc.TransferSyntax[0], UID('1.2.840.10008.1.2'))