コード例 #1
0
 def test_exists(self):
     """Test success path for Types.type_exists()"""
     types = Types()
     types.add_type("root", 3)
     assert types.type_exists(type_id=3) is True
     assert types.type_exists(name='root') is True
     assert types.type_exists(type_id=0) is False
     assert types.type_exists(name='osd') is False
コード例 #2
0
 def test_exists_except(self):
     """Test exceptions returned by Types.type_exists()"""
     types = Types()
     with pytest.raises(TypeError):
         types.type_exists(name=71)
     with pytest.raises(TypeError):
         types.type_exists(type_id="string")
     with pytest.raises(ValueError):
         types.type_exists(name="")