Approximate equality in numeric tests

This commit is contained in:
Miro Hrončok 2019-07-08 15:52:46 +02:00
commit 4dfffac478
2 changed files with 35 additions and 0 deletions

32
497.patch Normal file
View file

@ -0,0 +1,32 @@
From b61b8bb719fc676d5a140015a829c6a08d04abb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
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

View file

@ -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