Skip to content

Commit

Permalink
Use ==/!= to compare str, bytes, and int literals
Browse files Browse the repository at this point in the history
Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise __SyntaxWarnings__ so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8

% __python__
```
>>> consumer = "cons"
>>> consumer += "umer"
>>> consumer == "consumer"
True
>>> consumer is "consumer"
False
>>> 0 == 0.0
True
>>> 0 is 0.0
False
```
  • Loading branch information
cclauss authored and jeffwidman committed Feb 5, 2020
1 parent 385f603 commit 7008fd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/test_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_autocommit_enable_api_version(client, api_version):


def test_protocol_type(coordinator):
assert coordinator.protocol_type() is 'consumer'
assert coordinator.protocol_type() == 'consumer'


def test_group_protocols(coordinator):
Expand Down

0 comments on commit 7008fd4

Please sign in to comment.