diff --git a/tqdm_6/tqdm/_tqdm.py b/tqdm_6/tqdm/_tqdm.py index ab42ed8..04b2961 100755 --- a/tqdm_6/tqdm/_tqdm.py +++ b/tqdm_6/tqdm/_tqdm.py @@ -853,7 +853,7 @@ def __len__(self): return self.total if self.iterable is None else \ (self.iterable.shape[0] if hasattr(self.iterable, "shape") else len(self.iterable) if hasattr(self.iterable, "__len__") - else getattr(self, "total", None)) + else self.total) def __enter__(self): return self diff --git a/tqdm_6/tqdm/tests/tests_synchronisation.py b/tqdm_6/tqdm/tests/tests_synchronisation.py index c3b8ae4..09da4ee 100644 --- a/tqdm_6/tqdm/tests/tests_synchronisation.py +++ b/tqdm_6/tqdm/tests/tests_synchronisation.py @@ -1,11 +1,11 @@ from __future__ import division -from tqdm import tqdm, TMonitor -from tests_tqdm import with_setup, pretest, posttest, SkipTest, \ - StringIO, closing +from tqdm import tqdm +from tests_tqdm import with_setup, pretest, posttest, StringIO, closing from tests_tqdm import DiscreteTimer, cpu_timify from time import sleep from threading import Event +from tqdm import TMonitor class FakeSleep(object): @@ -37,10 +37,6 @@ def create_fake_sleep_event(): return create_fake_sleep_event -def incr(x): - return x + 1 - - @with_setup(pretest, posttest) def test_monitor_thread(): """Test dummy monitoring thread""" @@ -166,16 +162,3 @@ def test_monitoring_multi(): # Check that class var monitor is deleted if no instance left tqdm.monitor_interval = 10 assert tqdm.monitor is None - - -@with_setup(pretest, posttest) -def test_imap(): - """Test multiprocessing.Pool""" - try: - from multiprocessing import Pool - except ImportError: - raise SkipTest - - pool = Pool() - res = list(tqdm(pool.imap(incr, range(100)), disable=True)) - assert res[-1] == 100