From 89f0798b9c076988d7205a488315d0b33ef2b012 Mon Sep 17 00:00:00 2001 From: Shenggao Date: Tue, 17 May 2016 15:18:21 +0800 Subject: [PATCH] improve coverage, update to v0.1.1 --- .travis.yml | 2 +- midict/__init__.py | 20 ++++---------------- setup.py | 2 +- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 97b70ae..3d2e477 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ install: # command to run tests script: - - coverage run tests/tests.py + - coverage run --source midict tests/tests.py after_success: coveralls diff --git a/midict/__init__.py b/midict/__init__.py index bfc4237..1a3b72d 100644 --- a/midict/__init__.py +++ b/midict/__init__.py @@ -4,7 +4,7 @@ import sys -__version__ = '0.1.0' +__version__ = '0.1.1' PY2 = sys.version_info[0] == 2 @@ -1199,10 +1199,7 @@ def __iter__(self, index=None): yield x else: - if index is None: - for x in (): - yield x - else: + if index is not None: raise KeyError('Index not found (dictionary is empty): %s' % (index,)) @@ -1219,10 +1216,7 @@ def __reversed__(self, index=None): for x in reversed(self.indices[index]): yield x else: - if index is None: - for x in (): - yield x - else: + if index is not None: raise KeyError('Index not found (dictionary is empty): %s' % (index,)) @@ -1683,10 +1677,7 @@ def itervalues(self): # single index for x in self._mapping.iterkeys(index): yield x else: - if index is None: - for x in (): - yield x - else: + if index is not None: raise KeyError('Index not found (dictionary is empty): %s' % (index,)) def iteritems(self): @@ -1696,9 +1687,6 @@ def iteritems(self): -1 if self.index_value is None else self.index_value]) for x in items: yield x - else: - for x in (): - yield x def keys(self): return list(self.iterkeys()) diff --git a/setup.py b/setup.py index 705ddf8..4766f6c 100644 --- a/setup.py +++ b/setup.py @@ -65,7 +65,7 @@ def split(self, *args, **kw): name=package_name, version=find_version(package_name, '__init__.py'), url='https://github.com/ShenggaoZhu/midict', - download_url = 'https://codeload.github.com/ShenggaoZhu/midict/zip/v0.1.0', + download_url = 'https://codeload.github.com/ShenggaoZhu/midict/zip/v0.1.1', license='MIT', description= 'MIDict is an ordered "dictionary" with multiple indices '