Пример #1
0
    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"
Пример #2
0
 def test_non_list_data_is_invalid(self, data):
     with pytest.raises(ParseError, match="list"):
         List(Base).parse(Node(data))
Пример #3
0
 def test_empty_list_is_ok(self):
     assert List(Base).parse(Node([])).data == []
Пример #4
0
    def test_list_is_ok(self):
        obj = List(Base).parse(Node([Node("a"), Node("b")]))

        assert obj.bare == ["a", "b"]