created test files
This commit is contained in:
parent
1e1e5c2e88
commit
8b8cd3bee0
43
src/test_textnode.py
Normal file
43
src/test_textnode.py
Normal 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()
|
Loading…
Reference in New Issue
Block a user