diff --git a/setup.py b/setup.py index 612f934a..c304dd5e 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup setup( name='tqdm', - version='2.0', + version='1.1', description='A Simple Python Progress Meter', license='MIT License', author='Noam Yorav-Raphael', diff --git a/tqdm/_tqdm.py b/tqdm/_tqdm.py index 50396328..6396a3e3 100755 --- a/tqdm/_tqdm.py +++ b/tqdm/_tqdm.py @@ -54,7 +54,7 @@ def format_meter(n, total, elapsed, ncols=None, prefix=''): try: unich = unichr - except: + except NameError: unich = chr bar = unich(0x2588)*bar_length diff --git a/tqdm/tests/tests_tqdm.py b/tqdm/tests/tests_tqdm.py index d5e9a371..6793c374 100644 --- a/tqdm/tests/tests_tqdm.py +++ b/tqdm/tests/tests_tqdm.py @@ -22,7 +22,7 @@ def test_format_interval(): def test_format_meter(): try: unich = unichr - except: + except NameError: unich = chr assert format_meter(0, 1000, 13) == \ @@ -50,7 +50,7 @@ def test_iterate_over_csv_rows(): test_csv_file = StringIO() writer = csv.writer(test_csv_file) for i in range(3): - writer.writerow(['test', 'test', 'test']) + writer.writerow(['test']*3) test_csv_file.seek(0) # Test that nothing fails if we iterate over rows @@ -110,3 +110,11 @@ def test_min_interval(): pass our_file.seek(0) assert " 0%| | 0/3 [00:00<" in our_file.read() + + +def test_min_iters(): + our_file = StringIO() + for i in tqdm(range(3), file=our_file, leave=True, miniters=4): + our_file.write('blank\n') + our_file.seek(0) + assert '\nblank\nblank\n' in our_file.read()