def test_list_is_ok(self): obj = List(Base).parse(Node([Node("a"), Node("b")])) assert len(obj.data) == 2 assert obj.data[0].data == "a" assert obj.data[1].data == "b"
def test_non_list_data_is_invalid(self, data): with pytest.raises(ParseError, match="list"): List(Base).parse(Node(data))
def test_empty_list_is_ok(self): assert List(Base).parse(Node([])).data == []
def test_list_is_ok(self): obj = List(Base).parse(Node([Node("a"), Node("b")])) assert obj.bare == ["a", "b"]