Beispiel #1
0
    def test_delta_insert_text(self):
        delta = Delta()

        assert delta.ops == []

        delta = (delta.insert('Hello',
                              None).insert(' ', None).insert('World!', None))

        assert len(delta.ops) == 1, delta.ops
        assert delta.ops == [Insert('Hello World!', None)]

        delta.insert('\n', None)
        delta.insert('Hello World', None)
        delta.insert('!', None)

        assert len(delta.ops) == 1, delta.ops
        assert delta.ops == [Insert('Hello World!\nHello World!', None)]
Beispiel #2
0
    def test_empty_ops(self):
        delta = Delta()
        delta.insert('').delete(0).retain(0)

        assert len(delta.ops) == 0