Skip to content

Commit 0db3ac8

Browse files
author
Tucker Beck
committed
Resolved issues found in code review
1 parent 9c3cebe commit 0db3ac8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pytest_flask/plugin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ def __eq__(self, other):
4242
else:
4343
return super_eq(other)
4444

45+
def __ne__(self, other):
46+
return not self.__eq__(other)
47+
4548

4649
def pytest_assertrepr_compare(op, left, right):
4750
if isinstance(left, JSONResponse) and op == '==':

tests/test_fixtures.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ def test_json_response_compare_to_status_code(self, client, accept_json):
3939
res = client.get(url_for('ping'), headers=accept_json)
4040
assert res == res
4141

42-
@pytest.mark.xfail(
43-
strict=True,
44-
reason='Assertion comparing result to non-matching int should fail',
45-
)
4642
def test_mismatching_eq_comparison(self, client, accept_json):
47-
assert client.get('fake-route', headers=accept_json) == 200
43+
with pytest.raises(AssertionError, match=r'Mismatch in status code'):
44+
assert client.get('fake-route', headers=accept_json) == 200
4845

4946
def test_dont_rewrite_existing_implementation(self, app, accept_json):
5047
class MyResponse(app.response_class):

0 commit comments

Comments
 (0)