From 4eddf634e7c3631a37b3415aa8df1673e18114df Mon Sep 17 00:00:00 2001 From: Nicholas Devenish Date: Sun, 18 Nov 2018 19:59:58 +0000 Subject: [PATCH] Rename and split out the testing, and reword the changelog. --- changelog/4327.bugfix.rst | 2 +- testing/python/approx.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/changelog/4327.bugfix.rst b/changelog/4327.bugfix.rst index 0b498cd09..72223af4e 100644 --- a/changelog/4327.bugfix.rst +++ b/changelog/4327.bugfix.rst @@ -1 +1 @@ -Loosen the definition of what ``approx`` considers a sequence +``approx`` again works with more generic containers, more precisely instances of ``Iterable`` and ``Sized`` instead of more restrictive ``Sequence``. diff --git a/testing/python/approx.py b/testing/python/approx.py index 0a91bb08f..26e6a4ab2 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -497,12 +497,13 @@ class TestApprox(object): assert approx(expected, rel=5e-7, abs=0) == actual assert approx(expected, rel=5e-8, abs=0) != actual - def test_generic_iterable_sized_object(self): - class newIterable(object): + def test_generic_sized_iterable_object(self): + class MySizedIterable(object): def __iter__(self): return iter([1, 2, 3, 4]) def __len__(self): return 4 - assert [1, 2, 3, 4] == approx(newIterable()) + expected = MySizedIterable() + assert [1, 2, 3, 4] == approx(expected)