def test_gamestat_checkData(): gs = GameStat() required = ['GameID', 'TeamID', 'PlayerID'] # This should raise a format error with pytest.raises(RuntimeError) as excinfo: needle = 'Foo' gs.checkData(needle, required) assert 'lookupID requires a dictionary' in str(excinfo.value) # This should raise a field error with pytest.raises(RuntimeError) as excinfo: needle = { 'Foo': 'Bar' } gs.checkData(needle, required) assert 'Submitted data is missing the following fields' in str(excinfo.value)