def test_value_from_parsed_string(self): t = token.Token("name", "[a-z]+", "s") assert t.value_from_parsed_string("abc") == "abc"
def test_parse(self): t = token.Token("name", "[a-zA-Z]+", "") assert t.parse("abc") == "abc" with pytest.raises(exceptions.ParseError): t.parse("ab2")
def test_regex(self): t = token.Token("name", "[a-zA-Z]+", "") assert t.regex() == "[a-zA-Z]+"
def test_format_spec(self): t = token.Token("name", "[a-z]", "") assert t.format_spec == ""
def test_format(self): t = token.Token("name", "[a-zA-Z]+", "") assert t.format("abc") == "abc" with pytest.raises(exceptions.FormatError): t.format("123")
def test_name(self): t = token.Token("name", "", "") assert t.name == "name"
def test_str(self): t = token.Token("name", "[a-zA-Z]+", "") assert str(t) == "name"
def test_repr(self): t = token.Token("name", "[a-zA-Z]+", "") assert repr( t ) == "Token('name', '[a-zA-Z]+', '', description='', default=None)"