2
"""Test suite for UID.py"""
3
# Copyright (c) 2008 Darcy Mason
4
# This file is part of pydicom, released under a modified MIT license.
5
# See the file license.txt included with this distribution, also
6
# available at http://pydicom.googlecode.com
9
from dicom.UID import UID
11
class UIDtests(unittest.TestCase):
12
def testKnownUID(self):
13
"""UID: Known UID properties accessed....................."""
14
uid = UID('1.2.840.10008.1.2') # Implicit VR Little Endian
15
expected = 'Implicit VR Little Endian'
17
self.assertEqual(got, expected, "UID: expected '%s', got '%s' for UID name" % (expected, got))
19
expected = 'Transfer Syntax'
21
self.assertEqual(got, expected, "UID: expected '%s', got '%s' for UID type" % (expected, got))
23
expected = 'Default Transfer Syntax for DICOM'
25
self.assertEqual(got, expected, "UID: expected '%s', got '%s' for UID info" % (expected, got))
29
self.assertEqual(got, expected, "UID: expected '%s', got '%s' for UID is_retired" % (expected, got))
30
def testComparison(self):
31
"""UID: can compare by number or by name.................."""
32
uid = UID('1.2.840.10008.1.2')
33
self.assertEqual(uid, 'Implicit VR Little Endian', "UID equality failed on name")
34
self.assertEqual(uid, '1.2.840.10008.1.2', "UID equality failed on number string")
35
def testCompareNumber(self):
36
"""UID: comparing against a number give False............."""
39
self.assertNotEqual(uid, 3, "Comparison against a number returned True")
40
def testCompareNone(self):
41
"""UID: comparing against None give False................."""
44
self.assertNotEqual(uid, None, "Comparison against a number returned True")
45
def testTransferSyntaxes(self):
49
if __name__ == "__main__":