def test_gameevent_checkData(): ge = GameEvent() required = ['GameID', 'TeamID', 'PlayerID', 'MinuteID'] # This should raise a format error with pytest.raises(RuntimeError) as excinfo: needle = 'Foo' ge.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' } ge.checkData(needle, required) assert 'Submitted data is missing the following fields' in str(excinfo.value)