~ubuntu-branches/ubuntu/precise/pydicom/precise

« back to all changes in this revision

Viewing changes to dicom/test/test_UID.py

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2011-11-18 15:16:34 UTC
  • mfrom: (1.2.1) (2.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20111118151634-xiusfypm3ifjai1x
Tags: 0.9.6-1
* New upstream release
* Boosted policy compliance to 3.9.2 -- no changes
* Packaging is no longer done based on a fragile hg2git bridging back to
  the source distribution tarballs:
  - debian/gbp.conf adjusted correspondingly to use 'overlay' approach
  - debian/rules fixed to not cd to sources any longer
* Converted to use dh_python2
* Build-depend on python-all and python-numpy for testing

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# test_UID.py
 
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
 
7
 
 
8
import unittest
 
9
from dicom.UID import UID
 
10
 
 
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'
 
16
        got = uid.name
 
17
        self.assertEqual(got, expected, "UID: expected '%s', got '%s' for UID name" % (expected, got))
 
18
        
 
19
        expected = 'Transfer Syntax'
 
20
        got = uid.type
 
21
        self.assertEqual(got, expected, "UID: expected '%s', got '%s' for UID type" % (expected, got))
 
22
        
 
23
        expected = 'Default Transfer Syntax for DICOM'
 
24
        got = uid.info
 
25
        self.assertEqual(got, expected, "UID: expected '%s', got '%s' for UID info" % (expected, got))
 
26
        
 
27
        expected = False
 
28
        got = uid.is_retired
 
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............."""
 
37
        # From issue 96
 
38
        uid = UID('1.2.3')
 
39
        self.assertNotEqual(uid, 3, "Comparison against a number returned True")
 
40
    def testCompareNone(self):
 
41
        """UID: comparing against None give False................."""
 
42
        # From issue 96
 
43
        uid = UID('1.2.3')
 
44
        self.assertNotEqual(uid, None, "Comparison against a number returned True")
 
45
    def testTransferSyntaxes(self):
 
46
        pass
 
47
        
 
48
        
 
49
if __name__ == "__main__":
 
50
    unittest.main()