Rename and split out the testing, and reword the changelog.
This commit is contained in:
parent
1a8d9bf254
commit
4eddf634e7
|
@ -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``.
|
||||||
|
|
|
@ -497,12 +497,13 @@ class TestApprox(object):
|
||||||
assert approx(expected, rel=5e-7, abs=0) == actual
|
assert approx(expected, rel=5e-7, abs=0) == actual
|
||||||
assert approx(expected, rel=5e-8, abs=0) != actual
|
assert approx(expected, rel=5e-8, abs=0) != actual
|
||||||
|
|
||||||
def test_generic_iterable_sized_object(self):
|
def test_generic_sized_iterable_object(self):
|
||||||
class newIterable(object):
|
class MySizedIterable(object):
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter([1, 2, 3, 4])
|
return iter([1, 2, 3, 4])
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return 4
|
return 4
|
||||||
|
|
||||||
assert [1, 2, 3, 4] == approx(newIterable())
|
expected = MySizedIterable()
|
||||||
|
assert [1, 2, 3, 4] == approx(expected)
|
||||||
|
|
Loading…
Reference in New Issue