-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unittest_load #199
base: main
Are you sure you want to change the base?
unittest_load #199
Conversation
Load Unit Test
|
||
class TestExtractHTMLOp(unittest.TestCase): | ||
def test_extract_html_op_with_url(self): | ||
extract_op = ExtractHTMLOp("test_extract") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we init the function in the class?
e.g. self.extract_op = ExtractHTMLOp("test_splitter")
return_value="<html><body><p>Hello World</p></body></html>", | ||
): | ||
output = extract_op([node]) | ||
self.assertEqual(len(output), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we add a new line here?
def test_call_with_empty_node(self, mock_read_file):
# arrange
nodes = []
# act
output_nodes = self.extract_txt_op(nodes)
# assert
mock_read_file.assert_not_called()
self.assertEqual(len(output_nodes), 0)
self.assertEqual(output[0].value_dict["text"], "Hello World") | ||
|
||
def test_extract_html_op_with_filename(self): | ||
extract_op = ExtractHTMLOp("test_extract") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same above
output = extract_op([node]) | ||
self.assertEqual(len(output), 1) | ||
self.assertEqual(output[0].value_dict["text"], "") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it might be worth adding two more unit tests to test with more than one node and no node. https://medium.com/@samarthgvasist/parameterized-unit-testing-in-python-9be82fa7e17f
Unit Test For Load