miniter test, more specific exceptions, version 1.1

This commit is contained in:
Casper da Costa-Luis 2015-06-18 18:43:29 +01:00 committed by Casper da Costa-Luis
parent ffdafd64aa
commit 92bf2cff52
3 changed files with 12 additions and 4 deletions

View File

@ -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',

View File

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

View File

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