Skip to content

Commit

Permalink
Use is/is not instead of =/!= in type comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
subhashb committed Dec 5, 2023
1 parent b71aaf3 commit 7b354c9
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/adapters/broker/celery_broker/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ def register(self):
def test_that_an_event_is_published_to_the_broker(self, mock):
Person.add_newcomer({"first_name": "John", "last_name": "Doe", "age": 21})
mock.assert_called_once()
assert type(mock.call_args.args[0]) == dict
assert type(mock.call_args.args[0]) is dict
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_array_data_type_association(test_domain):
test_domain.register(ArrayUser)

model_cls = test_domain.repository_for(ArrayUser)._model
type(model_cls.roles.property.columns[0].type) == sa_types.ARRAY
type(model_cls.roles.property.columns[0].type) is sa_types.ARRAY


@pytest.mark.postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_json_data_type_association(test_domain):
test_domain.register(Event)

model_cls = test_domain.repository_for(Event)._model
type(model_cls.payload.property.columns[0].type) == sa_types.JSON
type(model_cls.payload.property.columns[0].type) is sa_types.JSON


@pytest.mark.postgresql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_array_data_type_association(test_domain):
test_domain.register(ArrayUser)

model_cls = test_domain.repository_for(ArrayUser)._model
type(model_cls.roles.property.columns[0].type) == sa_types.ARRAY
type(model_cls.roles.property.columns[0].type) is sa_types.ARRAY


@pytest.mark.sqlite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_json_data_type_association(test_domain):
test_domain.register(Event)

model_cls = test_domain.repository_for(Event)._model
type(model_cls.payload.property.columns[0].type) == sa_types.PickleType
type(model_cls.payload.property.columns[0].type) is sa_types.PickleType


@pytest.mark.sqlite
Expand Down
2 changes: 1 addition & 1 deletion tests/field/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DummyStringField(Field):

def _cast_to_type(self, value: str):
"""Value must me a string type"""
if type(value) != str:
if type(value) is not str:
self.fail("invalid_type")
return value

Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ def test_utcnow_func():

result = func()
assert result is not None
assert type(result) == datetime.datetime
assert type(result) is datetime.datetime

0 comments on commit 7b354c9

Please sign in to comment.