mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-20 11:48:30 -06:00
Fix python test failure on Travis.
It seems that there are two possible exceptions depending on OS.
This commit is contained in:
parent
c6ae007bda
commit
41656c920e
@ -28,11 +28,13 @@ class TestGncNumeric( TestCase ):
|
||||
self.assertEqual(num.num(), 3)
|
||||
self.assertEqual(num.denom(), 1)
|
||||
|
||||
#One might think this would be an overflow error, but SWIG type-checks
|
||||
#it first and discovers that it's too big to be an int64_t.
|
||||
with self.assertRaises(TypeError):
|
||||
with self.assertRaises(Exception) as context:
|
||||
GncNumeric((2**64)+1)
|
||||
|
||||
#On Linux it raises an OverflowError while on MacOS it's a TypeError.
|
||||
self.assertTrue(isinstance(context.exception, TypeError) or
|
||||
isinstance(context.exception, OverflowError))
|
||||
|
||||
def test_from_float(self):
|
||||
num = GncNumeric(3.1, 20, GNC_HOW_DENOM_FIXED | GNC_HOW_RND_NEVER)
|
||||
self.assertEqual(str(num), "62/20")
|
||||
|
Loading…
Reference in New Issue
Block a user