PR: Symmetrize QDateTime.toPython and toPyDateTime, etc.#421
Conversation
QDateTime.toPython and toPyDateTime, etc.QDateTime.toPython and toPyDateTime, etc.
|
What's the failed check? How has it come to that conclusion? I guess it's with Should I split the tests into individual functions? I certainly can, but that would decrease the readability of the code, making numerous functions, of which the |
CAM-Gerlach
left a comment
There was a problem hiding this comment.
In addition to parameterizing the tests, I also suggest doing an isinstance check that py_date has the expected Python type in each case. Thanks!
Seems like the coveralls hook status is just misbehaving because the actual run its linked to confirms the status is still the same. Hopefully the next push should fix it.
As my review suggests, you can instead achieve the same using Pytest's paramertization, which is actually shorter than the existing test code. |
I'm sorry I forgot to answer this. The point is that the type check is conducted internally in the
def __eq__(self, other):
if isinstance(other, date):
return self._cmp(other) == 0
return NotImplemented
def __eq__(self, other):
if isinstance(other, time):
return self._cmp(other, allow_mixed=True) == 0
else:
return NotImplemented
def __eq__(self, other):
if isinstance(other, datetime):
return self._cmp(other, allow_mixed=True) == 0
elif not isinstance(other, date):
return NotImplemented
else:
return False |
|
Ah, I see—technically, |
Oh, indeed. Thanks for the catch. I've added the explicit type checks. This should make the code more clear. |
|
Thanks! |
As far as I've noticed, the favorable Qt5 binding was PyQt5, and for Qt6 it's PySide6. They are different in many ways beside the Qt backend. One of the differences is the way to get Python date/time from the Qt one: it's
toPyDateTime/toPyDate/toPyTimein PyQt5/6 and onetoPythonto rule them all in PySide2/6.To ease the transfer from PyQt5 to PySide6, I propose the expansion of #169. And some tests for the results, as @CAM-Gerlach has suggested in #403 (comment).