MCPcopy
hub / github.com/python-attrs/attrs / test_validators_iterables

Method test_validators_iterables

tests/test_validators.py:792–808  ·  view source on GitHub ↗

If iterables are passed as validators, they are combined with and_.

(self, conv)

Source from the content-addressed store, hash-verified

790
791 @pytest.mark.parametrize("conv", [list, tuple])
792 def test_validators_iterables(self, conv):
793 """
794 If iterables are passed as validators, they are combined with and_.
795 """
796 key_validator = (instance_of(str), min_len(2))
797 value_validator = (instance_of(int), ge(10))
798 mapping_validator = (instance_of(dict), max_len(2))
799
800 v = deep_mapping(
801 conv(key_validator),
802 conv(value_validator),
803 conv(mapping_validator),
804 )
805
806 assert and_(*key_validator) == v.key_validator
807 assert and_(*value_validator) == v.value_validator
808 assert and_(*mapping_validator) == v.mapping_validator
809
810
811class TestIsCallable:

Callers

nothing calls this directly

Calls 6

instance_ofFunction · 0.90
min_lenFunction · 0.90
geFunction · 0.90
max_lenFunction · 0.90
deep_mappingFunction · 0.90
and_Function · 0.85

Tested by

no test coverage detected