Skip to content

Commit

Permalink
Compare types in test_orig_head with "is"
Browse files Browse the repository at this point in the history
This performs an exact type comparison with "is" instead of "==".
Most (maybe all?) of the rest of the places where "==" was used
have been changed previously, but this on fell through the cracks.
Like the None object, type objects use reference-based equality
comparison, and the idiomatic ways to check against them are "is"
for exactly comparisons and isinstance/issubclass otherwise.
  • Loading branch information
EliahKagan committed Dec 8, 2023
1 parent 86fcb1b commit e54277f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/test_refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_is_valid(self):
assert not SymbolicReference(self.rorepo, "hellothere").is_valid()

def test_orig_head(self):
assert type(self.rorepo.head.orig_head()) == SymbolicReference
assert type(self.rorepo.head.orig_head()) is SymbolicReference

@with_rw_repo("0.1.6")
def test_head_checkout_detached_head(self, rw_repo):
Expand Down

0 comments on commit e54277f

Please sign in to comment.