Skip to content

Commit

Permalink
use == instead of is to be reachable
Browse files Browse the repository at this point in the history
  • Loading branch information
lundberg committed Sep 15, 2022
1 parent 2e2b4bf commit f45ad46
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions tests/test_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,25 +317,25 @@ async def test_configured_router_reuse(client):
with router:
route.return_value = httpx.Response(202)
response = await client.get("https://foo/bar/")
assert route.called is True
assert route.called == True # noqa: E712
assert response.status_code == 202
assert router.calls.call_count == 1
assert respx.calls.call_count == 0

assert len(router.routes) == 1
assert route.called is False
assert route.called == False # noqa: E712
assert router.calls.call_count == 0

async with router:
assert router.calls.call_count == 0
response = await client.get("https://foo/bar/")
assert route.called is True
assert route.called == True # noqa: E712
assert response.status_code == 404
assert router.calls.call_count == 1
assert respx.calls.call_count == 0

assert len(router.routes) == 1
assert route.called is False
assert route.called == False # noqa: E712
assert router.calls.call_count == 0
assert respx.calls.call_count == 0

Expand Down Expand Up @@ -396,20 +396,20 @@ async def test_start_stop(client):
try:
respx.start()
response = await client.get(url)
assert request.called is True
assert request.called == True # noqa: E712
assert response.status_code == 202
assert response.text == ""
assert respx.calls.call_count == 1

respx.stop(clear=False, reset=False)
assert len(respx.routes) == 1
assert respx.calls.call_count == 1
assert request.called is True
assert request.called == True # noqa: E712

respx.reset()
assert len(respx.routes) == 1
assert respx.calls.call_count == 0
assert request.called is False
assert request.called == False # noqa: E712

respx.clear()
assert len(respx.routes) == 0
Expand Down
2 changes: 1 addition & 1 deletion tests/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_remote_pass_through(using, client_lib, call_count): # pragma: nocover
assert response.json()["json"] == {"foo": "bar"}

assert respx_mock.calls.last.request.url == url
assert respx_mock.calls.last.response is None
assert respx_mock.calls.last.response == None # noqa: E711

assert route.call_count == call_count
assert respx_mock.calls.call_count == call_count
4 changes: 2 additions & 2 deletions tests/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,12 @@ def test_rollback():

assert len(router.routes) == 1
assert router.calls.call_count == 0
assert route.return_value is None
assert route.return_value == None # noqa: E711

router.rollback() # Empty initial state

assert len(router.routes) == 0
assert route.return_value is None
assert route.return_value == None # noqa: E711

# Idempotent
route.rollback()
Expand Down
6 changes: 3 additions & 3 deletions tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def backend_test():
foobar1 = respx.get(url, name="get_foobar") % dict(status_code=202, text="get")
foobar2 = respx.delete(url, name="del_foobar") % dict(text="del")

assert foobar1.called is False
assert foobar1.called == False # noqa: E712
assert foobar1.call_count == len(foobar1.calls)
assert foobar1.call_count == 0
with pytest.raises(IndexError):
Expand All @@ -44,8 +44,8 @@ async def backend_test():
get_response = await client.get(url)
del_response = await client.delete(url)

assert foobar1.called is True
assert foobar2.called is True
assert foobar1.called == True # noqa: E712
assert foobar2.called == True # noqa: E712
assert foobar1.call_count == 1
assert foobar2.call_count == 1
assert foobar1.calls.call_count == 1
Expand Down

0 comments on commit f45ad46

Please sign in to comment.