diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-07-30 09:33:01 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-07-30 09:33:01 +0200 |
commit | 3a6ee939ff58bb7753afc111218c51daaf9ba532 (patch) | |
tree | 9118975620a5d23d23562734d4340ed32b3919e9 /unittest/rational.py | |
parent | d0082eac5cfd6608994e0093def4054bc749e4b7 (diff) | |
download | pyexiv2-3a6ee939ff58bb7753afc111218c51daaf9ba532.tar.gz |
Rational.to_float().
Diffstat (limited to 'unittest/rational.py')
-rw-r--r-- | unittest/rational.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unittest/rational.py b/unittest/rational.py index 81edfb9..b10811d 100644 --- a/unittest/rational.py +++ b/unittest/rational.py @@ -48,6 +48,12 @@ class TestRational(unittest.TestCase): self.assertEqual(str(Rational(3, 5)), '3/5') self.assertEqual(str(Rational(-3, 5)), '-3/5') + def test_to_float(self): + self.assertEqual(Rational(3, 6).to_float(), 0.5) + self.assertEqual(Rational(11, 11).to_float(), 1.0) + self.assertEqual(Rational(-2, 8).to_float(), -0.25) + self.assertEqual(Rational(0, 3).to_float(), 0.0) + def test_equality(self): r1 = Rational(2, 1) r2 = Rational(2, 1) |