From f0240987c04e027d2c290fd676cf0c126455e877 Mon Sep 17 00:00:00 2001 From: Werner F Bruhin Date: Tue, 10 Jun 2014 13:15:36 +0200 Subject: [PATCH 1/4] - make it work in Py2 and Py3 --- wx/py/tests/test_version.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wx/py/tests/test_version.py b/wx/py/tests/test_version.py index 90df1187..b8467320 100644 --- a/wx/py/tests/test_version.py +++ b/wx/py/tests/test_version.py @@ -4,8 +4,6 @@ __author__ = "Patrick K. O'Brien " import unittest -import types - # Import from this module's parent directory. import os import sys @@ -38,7 +36,7 @@ class ModuleTestCase(unittest.TestCase): class VersionTestCase(unittest.TestCase): def test_VERSION(self): - self.assert_(type(version.VERSION) is types.StringType) + self.assert_(isinstance(version.VERSION, str)) if __name__ == '__main__': From 7f42cb6f7fc15c860ade202d9c275099828e34d8 Mon Sep 17 00:00:00 2001 From: Werner F Bruhin Date: Tue, 10 Jun 2014 13:45:59 +0200 Subject: [PATCH 2/4] - on Win8 this failed as FONTFAMILY_TELETYPE is ending up using FONTFAMILY_MODERN --- unittests/test_fontdlg.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unittests/test_fontdlg.py b/unittests/test_fontdlg.py index b90fef5a..beba3b6d 100644 --- a/unittests/test_fontdlg.py +++ b/unittests/test_fontdlg.py @@ -8,9 +8,13 @@ class fontdlg_Tests(wtc.WidgetTestCase): def test_fontdlg1(self): data = wx.FontData() - data.SetInitialFont(wx.FFont(15, wx.FONTFAMILY_TELETYPE)) - self.assertEqual(data.InitialFont.Family, wx.FONTFAMILY_TELETYPE) + # on Windows wx.FONTFAMILY_TELETYPE will actually use wx.FONTFAMILY_MODERN + data.SetInitialFont(wx.FFont(15, wx.FONTFAMILY_MODERN)) + self.assertEqual(data.InitialFont.Family, wx.FONTFAMILY_MODERN) + data.SetInitialFont(wx.FFont(15, wx.FONTFAMILY_SWISS)) + self.assertEqual(data.InitialFont.Family, wx.FONTFAMILY_SWISS) + dlg = wx.FontDialog(self.frame, data) # TODO: find a safe way to test ShowModal on native dialogs dlg.Destroy() From 72b529b59994a41c21651cb6b48e5baf3cf365e3 Mon Sep 17 00:00:00 2001 From: Werner F Bruhin Date: Tue, 10 Jun 2014 13:54:05 +0200 Subject: [PATCH 3/4] - fix the check for long for py3 --- unittests/test_dataview.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unittests/test_dataview.py b/unittests/test_dataview.py index ef239f7b..199c709d 100644 --- a/unittests/test_dataview.py +++ b/unittests/test_dataview.py @@ -1,6 +1,7 @@ import imp_unittest, unittest import wtc import wx +from wx.lib import six import wx.dataview as dv import os @@ -43,8 +44,11 @@ class dataview_Tests(wtc.WidgetTestCase): def test_dataviewItem7(self): # max integer size on platforms where long is 64-bit - n = 2**63 - 1 - assert type(n) is long + n = 2**63 - 1 + if six.PY3: + assert type(n) is int + else: + assert type(n) is long dvi = dv.DataViewItem(n) self.assertTrue(dvi) self.assertTrue(int(dvi.GetID()) == n) From d6d63cc54db724e132e049abc96acb33bf8da565 Mon Sep 17 00:00:00 2001 From: Werner F Bruhin Date: Tue, 10 Jun 2014 15:13:27 +0200 Subject: [PATCH 4/4] - number of lines is 2 (at least on Win8), so changed check - assertGreater looks clearer --- unittests/test_lib_expando.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittests/test_lib_expando.py b/unittests/test_lib_expando.py index 025aca95..3a1c0e6f 100644 --- a/unittests/test_lib_expando.py +++ b/unittests/test_lib_expando.py @@ -20,8 +20,8 @@ class lib_expando_Tests(wtc.WidgetTestCase): # All we can test here is that we have more lines than we started # with, since different platforms may wrap at different spots in the # string. - self.assertTrue(w.GetNumberOfLines() > 2) - self.assertTrue(bs2.height > bs1.height) + self.assertGreaterEqual(w.GetNumberOfLines(), 2) + self.assertGreater(bs2.height, bs1.height) #---------------------------------------------------------------------------