Discussion:
Phoenix - unittest for wx.lib.agw.floatspin
Werner
2014-04-10 10:08:40 UTC
Permalink
Hi,

Testing above I find it fails on this:

self.assertEqual(floatspin.GetMin(), 0)

error is:

Exception: AssertionError: FixedPoint('.00000000000000000000', 20) != 0

Changed test to:
self.assertEqual(floatspin.GetMin(), FS.FixedPoint(0, 20))

but still fails with this:

Exception: AssertionError: FixedPoint('.00000000000000000000', 20) !=
FixedPoint('.00000000000000000000', 20)

That the first one fails I understand, but why the second one?

Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-04-10 15:01:38 UTC
Permalink
Hi,
Post by Werner
Hi,
self.assertEqual(floatspin.GetMin(), 0)
Exception: AssertionError: FixedPoint('.00000000000000000000', 20) != 0
self.assertEqual(floatspin.GetMin(), FS.FixedPoint(0, 20))
Exception: AssertionError: FixedPoint('.00000000000000000000', 20) !=
FixedPoint('.00000000000000000000', 20)
That the first one fails I understand, but why the second one?
Working on the persist stuff I see this exception which I guess explains
the above, I think.

File "d:\devTools\Phoenix\demo\agw\PersistentControls.py", line 584, in
<module>
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
File "d:\devTools\Phoenix\demo\agw\run.py", line 160, in main
app.MainLoop()
File "c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\core.py",
line 1878, in MainLoop
rv = wx.PyApp.MainLoop(self)
File "c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\core.py",
line 2893, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
File "d:\devTools\Phoenix\demo\agw\PersistentControls.py", line 283, in
RegisterControls
self.Register()
File "d:\devTools\Phoenix\demo\agw\PersistentControls.py", line 304, in
Register
self.Register(child.GetChildren())
File "d:\devTools\Phoenix\demo\agw\PersistentControls.py", line 301, in
Register
self._persistMgr.RegisterAndRestore(child)
File
"c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\lib\agw\persist\persistencemanager.py",
line 618, in RegisterAndRestore
return self.Register(window) and self.Restore(window)
File
"c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\lib\agw\persist\persistencemanager.py",
line 542, in Restore
return self._persistentObjects[name].Restore()
File
"c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\lib\agw\persist\persistencemanager.py",
line 146, in Restore
return self._persistentHandler.Restore()
File
"c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\lib\agw\persist\persist_handlers.py",
line 1048, in Restore
if value >= minVal and value <= maxVal:

builtins.TypeError: unorderable types: float() >= FixedPoint()

Anyone knows of a FixedPoint class out there which is Python 3 and 2
compatible and has the rich comparison methods __eq__ etc.

FixedPoint used by wx.lib.agw.floatspin is a class within the module.

Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Robin Dunn
2014-04-18 00:30:16 UTC
Permalink
Post by Werner
Hi,
Post by Werner
Hi,
self.assertEqual(floatspin.GetMin(), 0)
Exception: AssertionError: FixedPoint('.00000000000000000000', 20) != 0
self.assertEqual(floatspin.GetMin(), FS.FixedPoint(0, 20))
Exception: AssertionError: FixedPoint('.00000000000000000000', 20) !=
FixedPoint('.00000000000000000000', 20)
That the first one fails I understand, but why the second one?
Working on the persist stuff I see this exception which I guess explains
the above, I think.
File "d:\devTools\Phoenix\demo\agw\PersistentControls.py", line 584, in
<module>
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
File "d:\devTools\Phoenix\demo\agw\run.py", line 160, in main
app.MainLoop()
File "c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\core.py",
line 1878, in MainLoop
rv = wx.PyApp.MainLoop(self)
File "c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\core.py",
line 2893, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
File "d:\devTools\Phoenix\demo\agw\PersistentControls.py", line 283, in
RegisterControls
self.Register()
File "d:\devTools\Phoenix\demo\agw\PersistentControls.py", line 304, in
Register
self.Register(child.GetChildren())
File "d:\devTools\Phoenix\demo\agw\PersistentControls.py", line 301, in
Register
self._persistMgr.RegisterAndRestore(child)
File
"c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\lib\agw\persist\persistencemanager.py",
line 618, in RegisterAndRestore
return self.Register(window) and self.Restore(window)
File
"c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\lib\agw\persist\persistencemanager.py",
line 542, in Restore
return self._persistentObjects[name].Restore()
File
"c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\lib\agw\persist\persistencemanager.py",
line 146, in Restore
return self._persistentHandler.Restore()
File
"c:\Python33\Lib\site-packages\wx-3.0.1-msw-phoenix\wx\lib\agw\persist\persist_handlers.py",
line 1048, in Restore
builtins.TypeError: unorderable types: float() >= FixedPoint()
Anyone knows of a FixedPoint class out there which is Python 3 and 2
compatible and has the rich comparison methods __eq__ etc.
FixedPoint used by wx.lib.agw.floatspin is a class within the module.
http://python3porting.com/problems.html#unorderable-types-cmp-and-cmp

It shouldn't be too difficult to remove __cmp__ and add the rich compare
methods. Py27 understands those as well.

Ah, I see you already added them in the PR. I would go ahead and remove
the __cmp__ method too.
--
Robin Dunn
Software Craftsman
http://wxPython.org
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Werner
2014-04-19 12:48:14 UTC
Permalink
Hi Robin,

On 4/18/2014 2:30, Robin Dunn wrote:

...
Post by Robin Dunn
Ah, I see you already added them in the PR. I would go ahead and
remove the __cmp__ method too.
Removed it, tests are still passing, and updated the PR.

Werner
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...