From 19a777d34a6a12473143082482cb9f05fd22b61b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 5 Apr 2020 10:18:35 +0530 Subject: [PATCH] id assertion tests --- src/pyj/read_book/test_cfi.pyj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pyj/read_book/test_cfi.pyj b/src/pyj/read_book/test_cfi.pyj index 2246dc488e..3446823fbd 100644 --- a/src/pyj/read_book/test_cfi.pyj +++ b/src/pyj/read_book/test_cfi.pyj @@ -42,6 +42,12 @@ def cfi_roundtripping(): assert_equal(decode(f'{path_to_p}/1:1'), {'node': p.firstChild, 'offset': 1}) p.appendChild(E.span('123', id=nid())) + span = p.lastChild + path_to_span = f'{path_to_p}/2[{span.id}]' p.appendChild(document.createTextNode('456')) assert_equal(encode(document, p.lastChild, 1), f'{path_to_p}/1:7') assert_equal(decode(f'{path_to_p}/1:7'), {'node': p.lastChild, 'offset': 1}) + assert_equal(encode(document, span), path_to_span) + assert_equal(decode(path_to_span), {'node': span}) + assert_equal(encode(document, span.firstChild, 1), f'{path_to_span}/1:1') + assert_equal(decode(f'{path_to_span}/1:1'), {'node': span.firstChild, 'offset': 1})