Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfehler committed Jun 3, 2024
1 parent 0bf4130 commit 421d904
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
10 changes: 4 additions & 6 deletions tests/element_does_not_exist.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,21 @@ def test_element_list_raises_with_unicode_query(self):

def test_element_list_contains_right_information_and_raises_right_exception(self):
"element list contains right information about query and raises nice exception message"
with pytest.raises(ElementDoesNotExist) as cm:
with pytest.raises(ElementDoesNotExist) as err:
element_list = self.browser.find_by_css(".element-that-dont-exists")
assert "css" == element_list.find_by
assert ".element-that-dont-exists" == element_list.query
element_list.first

expected_message = 'No elements were found with css ".element-that-dont-exists"'

e = cm.exception
assert expected_message == e.args[0]
assert expected_message == err.value.args[0]

def test_element_list_raises_when_element_first_doesnt_exists_in_element_context(
self,
):
"element list raises exception with right information in element context"
with pytest.raises(ElementDoesNotExist) as cm:
with pytest.raises(ElementDoesNotExist) as err:
element_list = self.browser.find_by_css("#inside").find_by_css(
".inner-element-that-dont-exists",
)
Expand All @@ -50,5 +49,4 @@ def test_element_list_raises_when_element_first_doesnt_exists_in_element_context

expected_message = 'No elements were found with css ".inner-element-that-dont-exists"'

e = cm.exception
assert expected_message == e.args[0]
assert expected_message == err.value.args[0]
5 changes: 2 additions & 3 deletions tests/test_djangoclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,11 @@ def test_can_clear_text_field_content(self):

def test_cant_switch_to_frame(self):
"django driver should not be able to switch to frames"
with pytest.raises(NotImplementedError) as cm:
with pytest.raises(NotImplementedError) as err:
self.browser.get_iframe("frame_123")
self.fail()

e = cm.exception
assert "django doesn't support frames." == e.args[0]
assert "django doesn't support frames." == err.value.args[0]

def test_simple_type(self):
"""
Expand Down
5 changes: 2 additions & 3 deletions tests/test_flaskclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@ def test_can_clear_url_content(self):

def test_cant_switch_to_frame(self):
"flask should not be able to switch to frames"
with pytest.raises(NotImplementedError) as cm:
with pytest.raises(NotImplementedError) as err:
self.browser.get_iframe("frame_123")
self.fail()

e = cm.exception
assert "flask doesn't support frames." == e.args[0]
assert "flask doesn't support frames." == err.value.args[0]

def test_simple_type(self):
"""
Expand Down
5 changes: 2 additions & 3 deletions tests/test_zopetestbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ def test_forward_to_none_page(self):

def test_cant_switch_to_frame(self):
"zope.testbrowser should not be able to switch to frames"
with pytest.raises(NotImplementedError) as cm:
with pytest.raises(NotImplementedError) as err:
self.browser.get_iframe("frame_123")
self.fail()

e = cm.exception
assert "zope.testbrowser doesn't support frames." == e.args[0]
assert "zope.testbrowser doesn't support frames." == err.value.args[0]

def test_simple_type(self):
"""
Expand Down

0 comments on commit 421d904

Please sign in to comment.