From 79fd20a472670e0a6f209d9e01b63df375aad79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Sat, 20 Aug 2022 15:07:19 +0200 Subject: [PATCH] Add link test with more trailing text. --- tests/03-links.org | 2 ++ tests/test_org.py | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/03-links.org b/tests/03-links.org index 0e1c978..7683c7f 100644 --- a/tests/03-links.org +++ b/tests/03-links.org @@ -15,3 +15,5 @@ This is a link with no description to [[* First level]]. This is [[id:03-markup-first-level-id][a link to a section by id]]. + + This is a [[https://codigoparallevar.com/3][web link]] followed up with some text. diff --git a/tests/test_org.py b/tests/test_org.py index d7c9234..7e16f4e 100644 --- a/tests/test_org.py +++ b/tests/test_org.py @@ -201,7 +201,7 @@ class TestSerde(unittest.TestCase): doc = load(f) links = list(doc.get_links()) - self.assertEqual(len(links), 4) + self.assertEqual(len(links), 5) self.assertEqual(links[0].value, "https://codigoparallevar.com/1") self.assertEqual(links[0].description, "web link") @@ -214,6 +214,9 @@ class TestSerde(unittest.TestCase): self.assertEqual(links[3].value, "id:03-markup-first-level-id") self.assertEqual(links[3].description, "a link to a section by id") + self.assertEqual(links[4].value, "https://codigoparallevar.com/3") + self.assertEqual(links[4].description, "web link") + ex = Doc( props=[ ("TITLE", "03-Links"), @@ -261,6 +264,12 @@ class TestSerde(unittest.TestCase): ), ".\n", ), + SPAN("\n"), + SPAN( + " This is a ", + WEB_LINK("web link", "https://codigoparallevar.com/3"), + " followed up with some text.\n", + ), ], ) ), @@ -273,7 +282,7 @@ class TestSerde(unittest.TestCase): doc = load(f) links = list(doc.get_links()) - self.assertEqual(len(links), 4) + self.assertEqual(len(links), 5) self.assertEqual(links[0].value, "https://codigoparallevar.com/1") self.assertEqual(links[0].description, "web link") links[0].value = "https://codigoparallevar.com/1-updated" @@ -294,6 +303,11 @@ class TestSerde(unittest.TestCase): links[3].value = "id:03-markup-non-existent-level-id" links[3].description = None + self.assertEqual(links[4].value, "https://codigoparallevar.com/3") + self.assertEqual(links[4].description, "web link") + links[4].value = "https://codigoparallevar.com/3-updated" + links[4].description = "web link #3 with update" + ex = Doc( props=[ ("TITLE", "03-Links"), @@ -345,6 +359,15 @@ class TestSerde(unittest.TestCase): ), ".\n", ), + SPAN("\n"), + SPAN( + " This is a ", + WEB_LINK( + "web link #3 with update", + "https://codigoparallevar.com/3-updated", + ), + " followed up with some text.\n", + ), ], ) ),