Merge pull request #83 from wernerfb/june_fixtests

some unittest corrections for Py3
This commit is contained in:
Robin Dunn
2015-02-04 13:44:47 -08:00
4 changed files with 15 additions and 9 deletions

View File

@@ -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)

View File

@@ -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()

View File

@@ -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)
#---------------------------------------------------------------------------

View File

@@ -4,8 +4,6 @@ __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
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__':