Exemplo n.º 1
0
 def test_schemes(self):
     d = _CodesDict('UCUM')
     assert 'UCUM' in list(d.schemes())
     schemes = list(codes.schemes())
     assert 'UCUM' in schemes
     assert 'DCM' in schemes
     assert 'SCT' in schemes
Exemplo n.º 2
0
 def test_dir(self):
     d = _CodesDict('UCUM')
     assert isinstance(d.dir(), list)
     assert "ArbitraryUnit" in d.dir()
     assert "Year" in d.dir()
     assert d.dir("xyz") == []
     assert "Radian" in d.dir("ia")
Exemplo n.º 3
0
 def test_dunder_dir(self):
     d = _CodesDict('UCUM')
     assert "ArbitraryUnit" in dir(d)
     assert "Year" in dir(d)
     assert "__delattr__" in dir(d)
     assert "trait_names" in dir(d)
     assert isinstance(dir(d), list)
Exemplo n.º 4
0
 def test_getattr_nonunique_attr_raises(self):
     attr = "LeftVentricularInternalDiastolicDimensionBSA"
     msg = f"Multiple code values for '{attr}' found: 80009-4, 80010-2"
     with pytest.raises(RuntimeError, match=msg):
         _CodesDict('LN').LeftVentricularInternalDiastolicDimensionBSA
Exemplo n.º 5
0
 def test_getattr_unknown_attr_raises(self):
     msg = "Unknown code name 'bar' for scheme 'UCUM'"
     with pytest.raises(AttributeError, match=msg):
         _CodesDict('UCUM').bar
Exemplo n.º 6
0
 def test_getattr_CID_with_scheme_raises(self):
     msg = "Cannot use a CID with a scheme dictionary"
     with pytest.raises(AttributeError, match=msg):
         _CodesDict('UCUM').cid2
Exemplo n.º 7
0
 def test_trait_names(self):
     d = _CodesDict('UCUM')
     assert "ArbitraryUnit" in d.trait_names()
     assert "Year" in d.trait_names()
     assert "__delattr__" in d.trait_names()
     assert "trait_names" in d.trait_names()