Debian Codegraph @

wxgeometrie/mathlib/tests/test_universal_functions.py

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
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 import math
7 import numpy
8 import sympy
9 from wxgeometrie.mathlib.universal_functions import asin, acos, atan
10
11 import wx_unittest
12
13 x = sympy.Symbol('x')
14
15 class MathlibTest(wx_unittest.TestCase):
16 def test_trigo(self):
17 # Vérifie que arcsin est correctement implémenté (appel à math, numpy ou
18 # sympy suivant le type d'objet).
19 self.assertAlmostEqual(asin(.2), math.asin(.2))
20 a, b, c = asin([.2, .3, .4])
21 d, e, f = numpy.arcsin([.2, .3, .4])
22 self.assertAlmostEqual(a, d)
23 self.assertAlmostEqual(b, e)
24 self.assertAlmostEqual(c, f)
25 self.assertEqual(asin(x + 1), sympy.asin(x + 1))
26 # Vérifie que arccos est correctement implémenté (appel à math, numpy ou
27 # sympy suivant le type d'objet).
28 self.assertAlmostEqual(acos(.2), math.acos(.2))
29 a, b, c = acos([.2, .3, .4])
30 d, e, f = numpy.arccos([.2, .3, .4])
31 self.assertAlmostEqual(a, d)
32 self.assertAlmostEqual(b, e)
33 self.assertAlmostEqual(c, f)
34 self.assertEqual(acos(x + 1), sympy.acos(x + 1))
35 # Vérifie que arctan est correctement implémenté (appel à math, numpy ou
36 # sympy suivant le type d'objet).
37 self.assertAlmostEqual(atan(.2), math.atan(.2))
38 a, b, c = atan([.2, .3, .4])
39 d, e, f = numpy.arctan([.2, .3, .4])
40 self.assertAlmostEqual(a, d)
41 self.assertAlmostEqual(b, e)
42 self.assertAlmostEqual(c, f)
43 self.assertEqual(atan(x + 1), sympy.atan(x + 1))