Skip to content
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

BeautifulSoup logic in separate file #56

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
11 changes: 8 additions & 3 deletions tests/test_bs_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,22 @@ def setUp(self, mocked_soup):
self.mocked_soup = mocked_soup
self.mocked_soup.select_one.return_value = 'some text'
self.selector = 'some_tag'
self.expected_text = 'some_tag1', 'some_tag2', 'some_tag3'
self.selectors = 'some_tag1', 'some_tag2', 'some_tag3'
self.select_one_values = ('some text1', 'some text2', 'some text3')

def test_bs_safe_select_return_expected_text_with_single_selector(self):
actual = self.source_page.bs_safe_select(self.mocked_soup,
self.selector)
self.assertEqual(actual, 'some text')
dkultasev marked this conversation as resolved.
Show resolved Hide resolved

def test_bs_safe_select_return_expected_text_with_many_selectors(self):
select_one = None
for select_one_value in self.select_one_values:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test is re-producing the same logic as in the function that is not good. This test is bad, but before answering what exactly is bad you need to answer the question posted under this function's source code.

select_one = select_one_value
self.mocked_soup.select_one.return_value = select_one
actual = self.source_page.bs_safe_select(self.mocked_soup,
self.expected_text)
self.assertEqual(actual, 'some text')
self.selectors)
self.assertEqual(actual, select_one)
dkultasev marked this conversation as resolved.
Show resolved Hide resolved

def test_bs_safe_select_return_false_when_no_object_is_found(
self):
Expand Down