def test_invalid_value(self):
     with pytest.raises(TypeError, match="Could not convert value"):
         IS(0.9)
     with pytest.raises(TypeError, match="Could not convert value"):
         IS("0.9")
     with pytest.raises(ValueError, match="could not convert string"):
         IS("foo")
Ejemplo n.º 2
0
Archivo: io.py Proyecto: RafeMcBeth/pps
def load_dvh_json(file_path_name):
    """

    :param file_path_name:
    :return:
    """

    with open(file_path_name, 'r', encoding='utf-8') as json_file:
        json_dict = json.load(json_file)
        # add pydicom key type (int)
        json_dict = {IS(k): v for k, v in json_dict.items()}
        return json_dict
 def test_valid_value(self):
     assert 42 == IS(42)
     assert 42 == IS("42")
     assert 42 == IS("42.0")
     assert 42 == IS(42.0)
 def test_empty_value(self):
     assert IS(None) is None
     assert IS("") is None
Ejemplo n.º 5
0
 def test_invalid_value(self):
     with pytest.raises(TypeError, match='Could not convert value'):
         IS(0.9)
     with pytest.raises(ValueError, match='invalid literal for int()'):
         IS('0.9')
Ejemplo n.º 6
0
 def test_valid_value(self):
     assert 42 == IS(42)
     assert 42 == IS('42')
     assert 42 == IS(42.0)
Ejemplo n.º 7
0
 def test_empty_value(self):
     assert '' == IS(None)
     assert '' == IS('')
Ejemplo n.º 8
0
 def test_invalid_value(self):
     with pytest.raises(TypeError, match="Could not convert value"):
         IS(0.9)
     with pytest.raises(ValueError, match="invalid literal for int()"):
         IS("0.9")