def test_float_empty(self): """Test empty float VR value""" ds = Dataset() ds.ExaminedBodyThickness = None assert ('(0010,9431) FL (no value available) # 0' ' ExaminedBodyThickness') == pretty_element( ds['ExaminedBodyThickness'])
def test_float_vm_one(self): """Test single float VR value""" ds = Dataset() ds.ExaminedBodyThickness = 1.23456 assert ('(0010,9431) FL [1.23456] # 1' ' ExaminedBodyThickness') == pretty_element( ds['ExaminedBodyThickness'])
def test_dsfloat_empty(self): """Test empty DSfloat VR value""" ds = Dataset() ds.EventElapsedTimes = None assert ('(0008,2130) DS (no value available) # 0' ' EventElapsedTimes') == pretty_element( ds['EventElapsedTimes'])
def test_dt_empty(self): """Test empty DT VR value""" ds = Dataset() ds.AcquisitionDateTime = None assert ('(0008,002A) DT (no value available) # 0' ' AcquisitionDateTime') == pretty_element( ds['AcquisitionDateTime'])
def test_bytes_long(self): """Test byte VRs containing lots of data""" ds = Dataset() ds.PixelData = b'\x00' * 128 ds['PixelData'].VR = 'OB' assert ('(7FE0,0010) OB (128 bytes of binary data) # 1' ' PixelData') == pretty_element(ds['PixelData'])
def test_da_empty(self): """Test empty DA VR value""" ds = Dataset() ds.InstanceCreationDate = None assert ('(0008,0012) DA (no value available) # 0' ' InstanceCreationDate') == pretty_element( ds['InstanceCreationDate'])
def test_str_vm_multi(self): """Test multi string VR value""" ds = Dataset() ds.PatientAge = ["10", "11"] assert ( r"(0010,1010) AS [10\11] # 2 PatientAge" ) == pretty_element(ds["PatientAge"])
def test_bytes_empty(self): """Test empty byte VRs""" ds = Dataset() ds.PixelData = b'' ds['PixelData'].VR = 'OB' assert ('(7FE0,0010) OB (no value available) # 0' ' PixelData') == pretty_element(ds['PixelData'])
def test_str_vm_one(self): """Test single string VR value""" ds = Dataset() ds.PatientAge = "10" assert ( "(0010,1010) AS [10] # 1 PatientAge" ) == pretty_element(ds["PatientAge"])
def test_str_empty(self): """Test empty string VR value""" ds = Dataset() ds.PatientAge = None assert ( "(0010,1010) AS (no value available) # 0 PatientAge" ) == pretty_element(ds["PatientAge"])
def test_pn_vm_one(self): """Test single PersonName VR value""" ds = Dataset() ds.PatientName = "Citizen^Jan" assert ( "(0010,0010) PN [Citizen^Jan] # 1 PatientName" ) == pretty_element(ds["PatientName"])
def test_float_vm_multi(self): """Test multi float VR value""" ds = Dataset() ds.ExaminedBodyThickness = [1.23456, 0.00001] assert (r'(0010,9431) FL [1.23456\1e-05] # 2' ' ExaminedBodyThickness') == pretty_element( ds['ExaminedBodyThickness'])
def test_seq_empty(self): """Test empty sequence""" ds = Dataset() ds.EventCodeSequence = [] assert ('(0008,2135) SQ (Sequence with 0 items) # 0' ' EventCodeSequence') == pretty_element( ds['EventCodeSequence'])
def test_is_empty(self): """Test empty IS VR value""" ds = Dataset() ds.StageNumber = None assert ( "(0008,2122) IS (no value available) # 0 StageNumber" ) == pretty_element(ds["StageNumber"])
def test_seq_vm_multi(self): """Test sequence with one item""" ds = Dataset() ds.EventCodeSequence = [Dataset(), Dataset()] assert ('(0008,2135) SQ (Sequence with 2 items) # 2' ' EventCodeSequence') == pretty_element( ds['EventCodeSequence'])
def test_pn_empty(self): """Test empty PersonName VR value""" ds = Dataset() ds.PatientName = None assert ( "(0010,0010) PN (no value available) # 0 PatientName" ) == pretty_element(ds["PatientName"])
def test_ui_vm_multi(self): """Test multi UI VR value""" ds = Dataset() ds.SOPInstanceUID = ['1.2.3.4', '1.2.3.4.5'] assert ( r'(0008,0018) UI [1.2.3.4\1.2.3.4.5] # 2' ' SOPInstanceUID' ) == pretty_element(ds['SOPInstanceUID'])
def test_ui_vm_one(self): """Test single UI VR value""" ds = Dataset() ds.SOPInstanceUID = '1.2.3.4' assert ( '(0008,0018) UI [1.2.3.4] # 1' ' SOPInstanceUID' ) == pretty_element(ds['SOPInstanceUID'])
def test_ui_empty(self): """Test empty UI VR value""" ds = Dataset() ds.SOPInstanceUID = None assert ( '(0008,0018) UI (no value available) # 0' ' SOPInstanceUID' ) == pretty_element(ds['SOPInstanceUID'])
def test_tm_empty(self): """Test empty TM VR value""" ds = Dataset() ds.PatientBirthTime = None assert ( '(0010,0032) TM (no value available) # 0' ' PatientBirthTime' ) == pretty_element(ds['PatientBirthTime'])
def test_str_vm_multi(self): """Test multi string VR value""" ds = Dataset() ds.PatientAge = ['10', '11'] assert ( r'(0010,1010) AS [10\11] # 2' ' PatientAge' ) == pretty_element(ds['PatientAge'])
def test_str_vm_one(self): """Test single string VR value""" ds = Dataset() ds.PatientAge = '10' assert ( '(0010,1010) AS [10] # 1' ' PatientAge' ) == pretty_element(ds['PatientAge'])
def test_pn_vm_multi(self): """Test multi PersonName VR value""" ds = Dataset() ds.PatientName = ['Citizen^Jan', 'Citizen^Snips'] assert ( r'(0010,0010) PN [Citizen^Jan\Citizen^Snips] # 2' ' PatientName' ) == pretty_element(ds['PatientName'])
def test_pn_vm_one(self): """Test single PersonName VR value""" ds = Dataset() ds.PatientName = 'Citizen^Jan' assert ( '(0010,0010) PN [Citizen^Jan] # 1' ' PatientName' ) == pretty_element(ds['PatientName'])
def test_int_vm_multi(self): """Test multi int VR value""" ds = Dataset() ds.BitsAllocated = [1234, 4] assert ( r'(0028,0100) US [1234\4] # 2' ' BitsAllocated' ) == pretty_element(ds['BitsAllocated'])
def test_int_vm_one(self): """Test single int VR value""" ds = Dataset() ds.BitsAllocated = 1234 assert ( '(0028,0100) US [1234] # 1' ' BitsAllocated' ) == pretty_element(ds['BitsAllocated'])
def test_int_empty(self): """Test empty int VR value""" ds = Dataset() ds.BitsAllocated = None assert ( '(0028,0100) US (no value available) # 0' ' BitsAllocated' ) == pretty_element(ds['BitsAllocated'])
def test_tm_vm_multi(self): """Test multi TM VR value""" config.datetime_conversion = True ds = Dataset() ds.PatientBirthTime = ['120102', '235959'] assert isinstance(ds.PatientBirthTime[0], TM) assert (r'(0010,0032) TM [120102\235959] # 2' ' PatientBirthTime') == pretty_element(ds['PatientBirthTime'])
def test_tm_vm_one(self): """Test single TM VR value""" config.datetime_conversion = True ds = Dataset() ds.PatientBirthTime = '120102' assert isinstance(ds.PatientBirthTime, TM) assert ('(0010,0032) TM [120102] # 1' ' PatientBirthTime') == pretty_element(ds['PatientBirthTime'])
def test_is_vm_multi(self): """Test multi IS VR value""" config.datetime_conversion = True ds = Dataset() ds.StageNumber = ['20200102', '19851231'] assert isinstance(ds.StageNumber[0], IS) assert (r'(0008,2122) IS [20200102\19851231] # 2' ' StageNumber') == pretty_element(ds['StageNumber'])