From: Daniele Varrazzo Date: Sat, 17 Dec 2022 04:08:56 +0000 (+0000) Subject: test(numpy): allow more approximation comparing float16 values X-Git-Tag: pool-3.2.0~70^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b842daa99291f59e9ab0eca019f891939e187279;p=thirdparty%2Fpsycopg.git test(numpy): allow more approximation comparing float16 values >>> numpy.float16("-0.00018227100372314453") -0.0001823 >>> -0.0001823 == pytest.approx(-0.00018227100372314453, rel=1e-5) False >>> -0.0001823 == pytest.approx(-0.00018227100372314453, rel=1e-3) True --- diff --git a/tests/fix_faker.py b/tests/fix_faker.py index 95012fcd2..5f7c48c5b 100644 --- a/tests/fix_faker.py +++ b/tests/fix_faker.py @@ -908,7 +908,7 @@ class Faker: return self.match_any(spec, int(got), want) def match_numpy_float16(self, spec, got, want): - return self.match_numpy_float32(spec, got, want) + return self.match_float(spec, got, want, approx=True, rel=1e-3) def match_numpy_float32(self, spec, got, want): return self.match_Float4(spec, got, want)