def positive(element, scheme): assert not isitbullshit(element, scheme) IsItBullshitMixin.assertNotBullshit(element, scheme) with pytest.raises(AssertionError): IsItBullshitMixin.assertBullshit(element, scheme) raise_for_problem(element, scheme)
def negative(element, scheme): assert isitbullshit(element, scheme) IsItBullshitMixin.assertBullshit(element, scheme) with pytest.raises(AssertionError): IsItBullshitMixin.assertNotBullshit(element, scheme) with pytest.raises(ItIsBullshitError): raise_for_problem(element, scheme)
def test_orskipped2(self): schema = {"foo": 1, "bar": OrSkipped(int), "baz": OrSkipped(str)} positive(schema, schema) stripped_schema = dict( (k, v) for k, v in iteritems(schema) if k != "baz") positive(schema, stripped_schema) raise_for_problem(stripped_schema, schema)
def test_orskipped2(self): schema = { "foo": 1, "bar": OrSkipped(int), "baz": OrSkipped(str) } positive(schema, schema) stripped_schema = dict( (k, v) for k, v in iteritems(schema) if k != "baz" ) positive(schema, stripped_schema) raise_for_problem(stripped_schema, schema)