def test_loader_service_error(): """Test if errors are thrown for invalid dictionary entries.""" loader = Loader.from_dict(serv_dict={"Service": None}) assert loader.char_types == {} assert loader.serv_types == {"Service": None} json_dicts = ({ "RequiredCharacteristics": ["Char 1", "Char 2"] }, { "UUID": "123456" }) for case in json_dicts: loader.serv_types["Service"] = case with pytest.raises(KeyError): loader.get_service("Service")
def test_loader_service_error(): """Test if errors are thrown for invalid dictionary entries.""" loader = Loader.from_dict(serv_dict={'Service': None}) assert loader.char_types == {} assert loader.serv_types == {'Service': None} json_dicts = ({ 'RequiredCharacteristics': ['Char 1', 'Char 2'] }, { 'UUID': '123456' }) for case in json_dicts: loader.serv_types['Service'] = case with pytest.raises(KeyError): loader.get_service('Service')
def test_loader_get_char_error(): """Test if errors are thrown for invalid dictionary entries.""" loader = Loader.from_dict(char_dict={'Char': None}) assert loader.char_types == {'Char': None} assert loader.serv_types == {} json_dicts = ({ 'Format': 'int', 'Permissions': 'read' }, { 'Format': 'int', 'UUID': '123456' }, { 'Permissions': 'read', 'UUID': '123456' }) for case in json_dicts: loader.char_types['Char'] = case with pytest.raises(KeyError): loader.get_char('Char')
def test_loader_get_char_error(): """Test if errors are thrown for invalid dictionary entries.""" loader = Loader.from_dict(char_dict={"Char": None}) assert loader.char_types == {"Char": None} assert loader.serv_types == {} json_dicts = ( { "Format": "int", "Permissions": "read" }, { "Format": "int", "UUID": "123456" }, { "Permissions": "read", "UUID": "123456" }, ) for case in json_dicts: loader.char_types["Char"] = case with pytest.raises(KeyError): loader.get_char("Char")