From 8b8cd3bee00827fef3fa7f5f9613a9d06fa93491 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Mon, 18 Mar 2024 19:35:18 -0400 Subject: [PATCH] created test files --- src/test_textnode.py | 43 +++++++++++++++++++++++++++++++++++++++++++ test.sh | 0 2 files changed, 43 insertions(+) create mode 100644 src/test_textnode.py mode change 100644 => 100755 test.sh diff --git a/src/test_textnode.py b/src/test_textnode.py new file mode 100644 index 0000000..b23235b --- /dev/null +++ b/src/test_textnode.py @@ -0,0 +1,43 @@ +import unittest + +from textnode import ( + TextNode, + text_type_text, + text_type_bold, + text_type_italic, + text_type_code, + text_type_image, + text_type_link, +) + +class TestTextNode(unittest.TestCase): + def test_eq(self): + node = TextNode("This is a text node", "bold") + node2 = TextNode("This is a text node", "bold") + self.assertEqual(node, node2) + + def test_eq_false(self): + node = TextNode("This is a text node", text_type_text) + node2 = TextNode("This is a text node", text_type_bold) + self.assertNotEqual(node, node2) + + def test_eq_false2(self): + node = TextNode("This is a text node", text_type_text) + node2 = TextNode("This is a text node2", text_type_text) + self.assertNotEqual(node, node2) + + def test_eq_url(self): + node = TextNode("This is a text node", text_type_italic, "https://www.boot.dev") + node2 = TextNode( + "This is a text node", text_type_italic, "https://www.boot.dev" + ) + self.assertEqual(node, node2) + + def test_repr(self): + node = TextNode("This is a text node", text_type_text, "https://www.boot.dev") + self.assertEqual( + "TextNode(This is a text node, text, https://www.boot.dev)", repr(node) + ) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/test.sh b/test.sh old mode 100644 new mode 100755