| 1 |
|
| 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.geolib import ( |
| 7 |
Point, Fonction, Interpolation_polynomiale_par_morceaux, |
| 8 |
Glisseur_courbe, Interpolation_lineaire, Courbe |
| 9 |
) |
| 10 |
|
| •11 |
import tools.unittests |
| 12 |
|
| •13 |
class GeolibTest(tools.unittests.TestCase): |
| 14 |
|
| 15 |
def test_Courbe(self): |
| 16 |
f = Fonction('1/(x+3)') |
| 17 |
c1 = Courbe(f) |
| 18 |
self.assertIsInstance(c1, Courbe) |
| 19 |
A = Point(0, 0) |
| 20 |
B = Point(-1, 2) |
| 21 |
C = Point(4, 3) |
| 22 |
D = Point(-3, 1) |
| 23 |
E = Point(4, 5) |
| 24 |
c2 = Courbe(A, B, C, D, E) |
| 25 |
try: |
| 26 |
import scipy |
| 27 |
self.assertIsInstance(c2, Interpolation_polynomiale_par_morceaux) |
| 28 |
except ImportError: |
| 29 |
self.assertIsInstance(c2, Interpolation_lineaire) |
| 30 |
|