From 4dfffac47873559f86e7b279bef8a5085f6047e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 8 Jul 2019 15:52:46 +0200 Subject: [PATCH] Approximate equality in numeric tests --- 497.patch | 32 ++++++++++++++++++++++++++++++++ python-uranium.spec | 3 +++ 2 files changed, 35 insertions(+) create mode 100644 497.patch diff --git a/497.patch b/497.patch new file mode 100644 index 0000000..477c4a4 --- /dev/null +++ b/497.patch @@ -0,0 +1,32 @@ +From b61b8bb719fc676d5a140015a829c6a08d04abb5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 8 Jul 2019 15:49:19 +0200 +Subject: [PATCH] Allow approximate equality in TestVector.test_normalize for + smaller arches + +Fixes https://github.com/Ultimaker/Uranium/issues/496 +--- + tests/Math/TestVector.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/Math/TestVector.py b/tests/Math/TestVector.py +index 33f7f0889..292f415f3 100644 +--- a/tests/Math/TestVector.py ++++ b/tests/Math/TestVector.py +@@ -3,6 +3,7 @@ + + import unittest + import numpy ++import pytest + + from UM.Math.Vector import Vector + +@@ -30,7 +31,7 @@ def test_angleBetweenVectors(self): + + def test_normalize(self): + vector = Vector(10, 10, 10) +- assert vector.normalized().length() == 1 ++ assert vector.normalized().length() == pytest.approx(1) + + def test_setValues(self): + x = 10 diff --git a/python-uranium.spec b/python-uranium.spec index c90dfb6..e098d90 100644 --- a/python-uranium.spec +++ b/python-uranium.spec @@ -6,6 +6,9 @@ License: LGPLv3+ URL: https://github.com/Ultimaker/Uranium Source0: %{url}/archive/%{version}.tar.gz#/Uranium-%{version}.tar.gz +# Approximate equality in numeric tests +Patch0: %{url}/pull/497.patch + BuildRequires: python3-devel BuildRequires: python3-pip BuildRequires: /usr/bin/doxygen