add test on printing for Fraction

This commit is contained in:
lafrite 2014-12-03 15:14:50 +01:00
parent f033cbad85
commit 573945a63a

View File

@ -121,6 +121,17 @@ class TestFraction(unittest.TestCase):
def test_le(self): def test_le(self):
pass pass
def test_tex(self):
f = Fraction(2, 3)
ans = "\\frac{ 2 }{ 3 }"
self.assertEqual(f.__tex__(), ans)
def test_txt(self):
f = Fraction(2, 3)
ans = "2 / 3"
self.assertEqual(f.__txt__(), ans)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()