pygit2 icon indicating copy to clipboard operation
pygit2 copied to clipboard

Fix mypy strict equality

Open kbaikov opened this issue 5 months ago • 3 comments

kbaikov avatar Aug 08 '25 06:08 kbaikov

Ping @jdavid any comments/review to this PR?

kbaikov avatar Aug 24 '25 20:08 kbaikov

Hi @kbaikov , sorry for the delay, have been busy.

-    assert ObjectType.BLOB == blob.type
+    assert int(ObjectType.BLOB) == blob.type

The thing is ObjectType.BLOB == blob.type should work and this should be tested in the unit tests.

If we are to make strict_equality = True then blob.type should return ObjectType.BLOB instead of 3. But this is likely difficult to do because blob.type is defined in C while ObjectType is defined in Python.

jdavid avatar Sep 02 '25 16:09 jdavid

Hi @kbaikov , sorry for the delay, have been busy.

-    assert ObjectType.BLOB == blob.type
+    assert int(ObjectType.BLOB) == blob.type

The thing is ObjectType.BLOB == blob.type should work and this should be tested in the unit tests.

If we are to make strict_equality = True then blob.type should return ObjectType.BLOB instead of 3. But this is likely difficult to do because blob.type is defined in C while ObjectType is defined in Python.

Done.

kbaikov avatar Sep 12 '25 09:09 kbaikov