From b384d8917507482b22afbc1328ba6a4b378283dc Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Mon, 18 Mar 2024 19:19:50 -0400 Subject: [PATCH] created initial textnode class --- src/textnode.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/textnode.py diff --git a/src/textnode.py b/src/textnode.py new file mode 100644 index 0000000..fb07681 --- /dev/null +++ b/src/textnode.py @@ -0,0 +1,15 @@ +class TextNode: + def __init__(self, text, text_type, url=None) -> None: + self.text = text + self.text_type = text_type + self.url = url + + def __eq__(self, other_node) -> bool: + return ( + self.text == other_node.text + and self.text_type == other_node.text_type + and self.url == other_node.url + ) + + def __repr__(self) -> str: + return f"TextNode({self.text}, {self.text_type}, {self.url})"