Debian Codegraph @

wxgeometrie/mathlib/tests/test_custom_objects.py

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 # -*- coding: utf-8 -*-
2 import os, sys
3 TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__),"../.."))
4 sys.path.insert(0, TOPDIR)
5
6 from wxgeometrie.mathlib.custom_objects import Decim
7 from sympy import Symbol, Rational, S
8
•9 import tools.unittests
10
11 x = Symbol('x')
12
•13 class MathlibTest(tools.unittests.TestCase):
14
15 def test_Decim(self):
16 expr = S.One*Decim('0.3')
17 self.assertIsInstance(expr, Decim), type(expr)
18 expr = Decim('0.3')*x
19 self.assertIsInstance(expr.args[0], Decim), type(expr.args[0])
20 self.assertEqual(repr(Decim(1, 2)*x + Decim(1, 5)), '0.5*x + 0.2')
21 self.assertEqual(repr(Decim(1, 2)*Rational(1, 5)), '0.1')