created test files

This commit is contained in:
John O'Keefe 2024-03-18 19:35:18 -04:00
parent 1e1e5c2e88
commit 8b8cd3bee0
2 changed files with 43 additions and 0 deletions

43
src/test_textnode.py Normal file
View File

@ -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()

0
test.sh Normal file → Executable file
View File