with pytest.raises(InvalidFieldTypeException):
Example(raw_value, address=addr)
for v in [0, object(), "strings are technically iterable...", [0, 1], ["hello", 1]]:
assert_invalid_type(v)
def test_string_or_string_sequence_field() -> None:
class Example(StringOrStringSequenceField):
After Change
alias = "example"
addr = Address.parse(":example")
assert Example(["hello", "world"], address=addr).value == ("hello", "world")
assert Example(None, address=addr).value is None
with pytest.raises(InvalidFieldTypeException):
Example("strings are technically iterable...", address=addr)
with pytest.raises(InvalidFieldTypeException):