Debian Codegraph @

debian/patches/test_float128.patch

raw
1 --- a/python/test/unit/la/test_vector.py
2 +++ b/python/test/unit/la/test_vector.py
3 @@ -22,6 +22,7 @@
4 import pytest
5 import numpy
6 from copy import copy
7 +from ctypes import c_long
8
9 from dolfin import *
10 from dolfin_utils.test import *
11 @@ -398,17 +399,21 @@
12 xfail_type = pytest.mark.xfail(strict=True, raises=TypeError)
13 xfail_type_py3 = pytest.mark.xfail(strict=True, raises=TypeError)
14
15 -
16 + # some systems (32 bit arches) do not have numpy.float128
17 + try:
18 + test_float128 = numpy.float128(42.0)
19 + except AttributeError:
20 + test_float128 = numpy.longdouble(42.0)
21 @pytest.mark.parametrize("operand",
22 - [int(42), 42.0, numpy.sin(1.0), numpy.float(42.0),
23 - numpy.float64(42.0), numpy.float_(42.0),
24 - numpy.int(42.0), numpy.long(42.0),
25 + [int(42), 42.0, numpy.sin(1.0), float(42.0),
26 + numpy.float64(42.0),
27 + int(42.0), c_long(42).value,
28 numpy.float16(42.0), numpy.float16(42.0),
29 - numpy.float32(42.0), numpy.float128(42.0),
30 - numpy.longfloat(42.0), numpy.int8(42.0),
31 + numpy.float32(42.0), test_float128,
32 + numpy.longdouble(42.0), numpy.int8(42.0),
33 numpy.int16(42.0), numpy.int32(42.0),
34 numpy.intc(42.0), numpy.longdouble(42.0),
35 - numpy.int0(42.0), numpy.int64(42.0),
36 + numpy.intp(42.0), numpy.int64(42.0),
37 numpy.int_(42.0), numpy.longlong(42.0),
38 ])
39 def test_vector_type_priority_with_numpy(self, any_backend, operand):
40 --- a/python/test/unit/la/test_la_basic.py
41 +++ b/python/test/unit/la/test_la_basic.py
42 @@ -89,8 +89,8 @@
43 def test_vector(self, any_backend):
44 self.backend, self.sub_backend = any_backend
45 from numpy import ndarray, linspace, array, fromiter
46 - from numpy import int,int0,int16,int32,int64
47 - from numpy import uint,uint0,uint16,uint32,uint64
48 + from numpy import intp,int16,int32,int64
49 + from numpy import uint,uintp,uint16,uint32,uint64
50 mesh = UnitSquareMesh(3, 3)
51 v, w = assemble_vectors(mesh)
52
53 @@ -102,8 +102,8 @@
54
55 # Test set and access with different integers
56 lind = 2
57 - for T in [int,int16,int32,int64,uint,uint0,uint16,uint32,uint64,\
58 - int0]:
59 + for T in [int,int16,int32,int64,uint,uintp,uint16,uint32,uint64,\
60 + intp]:
61 v[T(lind)] = 2.0
62 assert round(v[T(lind)] - 2.0, 7) == 0
63
64 --- a/python/test/unit/function/test_expression.py
65 +++ b/python/test/unit/function/test_expression.py
66 @@ -22,7 +22,7 @@
67 import pytest
68 from dolfin import *
69 from math import sin, cos, exp, tan
70 -from numpy import array, zeros, float_
71 +from numpy import array, zeros
72 import numpy as np
73
74 from dolfin_utils.test import fixture, skip_in_parallel