@@ -26,30 +26,27 @@ def test_qtmsghandler():
2626 assert QtCore .qInstallMessageHandler is not None
2727
2828
29- def test_QDateTime_toPython_and_toPyDateTime ():
29+ @pytest .mark .parametrize ('method' , ['toPython' , 'toPyDateTime' ])
30+ def test_QDateTime_toPython_and_toPyDateTime (method ):
3031 """Test `QDateTime.toPython` and `QDateTime.toPyDateTime`"""
3132 q_datetime = QtCore .QDateTime (NOW )
32- py_date = q_datetime .toPython ()
33- assert py_date == NOW
34- py_date = q_datetime .toPyDateTime ()
35- assert py_date == NOW
33+ py_datetime = getattr (q_datetime , method )()
34+ assert py_datetime == NOW
3635
3736
38- def test_QDate_toPython_and_toPyDate ():
37+ @pytest .mark .parametrize ('method' , ['toPython' , 'toPyDate' ])
38+ def test_QDate_toPython_and_toPyDate (method ):
3939 """Test `QDate.toPython` and `QDate.toPyDate`"""
4040 q_date = QtCore .QDateTime (NOW ).date ()
41- py_date = q_date .toPython ()
42- assert py_date == NOW .date ()
43- py_date = q_date .toPyDate ()
41+ py_date = getattr (q_date , method )()
4442 assert py_date == NOW .date ()
4543
4644
47- def test_QTime_toPython_and_toPyTime ():
45+ @pytest .mark .parametrize ('method' , ['toPython' , 'toPyTime' ])
46+ def test_QTime_toPython_and_toPyTime (method ):
4847 """Test `QTime.toPython` and `QTime.toPyTime`"""
4948 q_time = QtCore .QDateTime (NOW ).time ()
50- py_time = q_time .toPython ()
51- assert py_time == NOW .time ()
52- py_time = q_time .toPyTime ()
49+ py_time = getattr (q_time , method )()
5350 assert py_time == NOW .time ()
5451
5552
0 commit comments