Rename and split out the testing, and reword the changelog.

This commit is contained in:
Nicholas Devenish 2018-11-18 19:59:58 +00:00
parent 1a8d9bf254
commit 4eddf634e7
2 changed files with 5 additions and 4 deletions

View File

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

View File

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