code stringlengths 3 6.57k |
|---|
func(correct) |
pytest.raises(deal.PreContractError) |
func(incorrect) |
test_chain_all_contracts_fulfilled(self, correct, incorrect_min, incorrect_max) |
deal.pre(lambda x: x < 10) |
deal.pre(lambda x: x > 0) |
func(correct) |
pytest.raises(deal.PreContractError) |
func(incorrect_min) |
pytest.raises(deal.PreContractError) |
func(incorrect_max) |
test_correct_exceptions_raised_on_contract_fail(self) |
deal.pre(lambda x: x > 0) |
pytest.raises(deal.PreContractError) |
func(-2) |
deal.pre(lambda x: x > 0, message='TEST') |
func(-2) |
deal.pre(lambda x: x > 0, exception=NameError) |
pytest.raises(NameError) |
func(-2) |
deal.pre(lambda x: x > 0, exception=NameError('TEST') |
pytest.raises(NameError) |
func(-2) |
func(-2) |
deal.pre(lambda x: x > 0, message='TEST', exception=NameError) |
pytest.raises(NameError) |
func(-2) |
func(-2) |
test_raise_error_with_param_on_contract_failure(self) |
deal.pre(lambda x: x > 0 or 'TEST') |
func(4) |
pytest.raises(deal.PreContractError) |
func(-2) |
func(-2) |
test_method_decoration_name_is_correct(self) |
deal.pre(lambda x: x > 0) |
some_function(x) |
test_class_method_decorator_raises_error_on_contract_fail(self) |
deal.pre(lambda self, x: x > 0) |
method(self, x) |
deal.pre(lambda self, x: x > 0) |
method2(self, y) |
Class() |
method(2) |
Class() |
method2(2) |
pytest.raises(deal.PreContractError) |
Class() |
method(-2) |
pytest.raises(deal.PreContractError) |
Class() |
method2(-2) |
_test_validator(self, validator) |
deal.pre(validator) |
func(4) |
pytest.raises(deal.PreContractError) |
func(-2) |
func(-2) |
test_return_value_fulfils_contract(self) |
deal.post(lambda x: x > 0) |
func(-4) |
pytest.raises(deal.PostContractError) |
func(4) |
test_setting_object_attribute_fulfills_contract(self) |
deal.inv(lambda obj: obj.x > 0) |
A() |
pytest.raises(deal.InvContractError) |
test_setting_wrong_args_by_method_raises_error(self) |
deal.inv(lambda obj: obj.x > 0) |
f(self, x) |
A() |
a.f(4) |
pytest.raises(deal.InvContractError) |
a.f(-2) |
test_chain_contracts_both_fulfill(self) |
deal.inv(lambda obj: obj.x > 0) |
deal.inv(lambda obj: obj.x < 10) |
A() |
pytest.raises(deal.InvContractError) |
pytest.raises(deal.InvContractError) |
test_patched_invariants_instance(self) |
deal.inv(lambda obj: obj.x > 0) |
PatchedA() |
isinstance(a, PatchedA) |
isinstance(a, A) |
deal.inv(lambda obj: obj.x > 0) |
PatchedA2() |
isinstance(a, PatchedA) |
isinstance(a, PatchedA2) |
isinstance(a, A) |
a.__class__.__name__.count('Invarianted') |
MarshmallowSchemeTests(unittest.TestCase) |
setUp(self) |
_Scheme(marshmallow.Schema) |
marshmallow.fields.Str() |
vaa.marshmallow(_Scheme) |
test_scheme_string_validation_args_correct(self) |
deal.pre(self.Scheme) |
func(name) |
func('Chris') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.