expects
Advanced tools
+1
-1
@@ -62,3 +62,3 @@ # -*- coding: utf-8 -*- | ||
| # The full version, including alpha/beta/rc tags. | ||
| release = '0.8.0rc3' | ||
| release = '0.8.0rc4' | ||
@@ -65,0 +65,0 @@ # The language for content autogenerated by Sphinx. Refer to documentation |
| Metadata-Version: 1.1 | ||
| Name: expects | ||
| Version: 0.8.0rc3 | ||
| Version: 0.8.0rc4 | ||
| Summary: Expressive and extensible TDD/BDD assertion library for Python | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/jaimegildesagredo/expects |
@@ -82,2 +82,3 @@ # -*- coding: utf-8 -* | ||
| reasons = [] | ||
| try: | ||
@@ -89,15 +90,24 @@ for index, expected_item in enumerate(self._expected): | ||
| return False, ['item {0!r} not found at index {1}'.format(expected_item, index)] | ||
| else: | ||
| reasons.append('item {0!r} found at index {1}'.format(expected_item, index)) | ||
| except IndexError: | ||
| return False, ['item {0!r} not found at index {1}'.format(expected_item, index)] | ||
| return len(subject) == len(self._expected), ['have a different length'] | ||
| if len(subject) != len(reasons): | ||
| return False, ['have a different length'] | ||
| return True, reasons | ||
| def __match_string(self, subject): | ||
| currentIndex = 0 | ||
| reasons = [] | ||
| index = 0 | ||
| for part in self._expected: | ||
| if part != subject[currentIndex:currentIndex+len(part)]: | ||
| return False, ['item equal {0!r} not found at index {1}'.format(part, currentIndex)] | ||
| currentIndex = len(part) | ||
| if part != subject[index:index+len(part)]: | ||
| return False, ['item equal {0!r} not found at index {1}'.format(part, index)] | ||
| else: | ||
| reasons.append('item equal {0!r} found at index {1}'.format(part, index)) | ||
| index = len(part) | ||
| return len(subject) == len(''.join(self._expected)), ['have a different length'] | ||
| if len(subject) != len(''.join(self._expected)): | ||
| return False, ['have a different length'] | ||
| return True, reasons | ||
@@ -108,6 +118,3 @@ | ||
| if isinstance(subject, _compat.string_types): | ||
| for item in self._expected: | ||
| if not item in subject: | ||
| return False, ['item {0!r} not found'.format(item)] | ||
| return len(subject) == len(''.join(self._expected)), ['have a different length'] | ||
| return self.__match_string(subject) | ||
@@ -118,2 +125,16 @@ result, reason = super(contain_only, self)._matches(subject) | ||
| return len(subject) == len(self._expected), ['have a different length'] | ||
| if len(subject) != len(self._expected): | ||
| return False, ['have a different length'] | ||
| return True, reason | ||
| def __match_string(self, subject): | ||
| reasons = [] | ||
| for item in self._expected: | ||
| if not item in subject: | ||
| return False, ['item {0!r} not found'.format(item)] | ||
| else: | ||
| reasons.append('item {0!r} found'.format(item)) | ||
| if len(subject) != len(''.join(self._expected)): | ||
| return False, ['have a different length'] | ||
| return True, reasons |
+1
-1
| Metadata-Version: 1.1 | ||
| Name: expects | ||
| Version: 0.8.0rc3 | ||
| Version: 0.8.0rc4 | ||
| Summary: Expressive and extensible TDD/BDD assertion library for Python | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/jaimegildesagredo/expects |
+1
-1
| [egg_info] | ||
| tag_date = 0 | ||
| tag_svn_revision = 0 | ||
| tag_build = | ||
| tag_date = 0 | ||
+1
-1
@@ -9,3 +9,3 @@ # -*- coding: utf-8 -*- | ||
| name='expects', | ||
| version='0.8.0rc3', | ||
| version='0.8.0rc4', | ||
| description='Expressive and extensible TDD/BDD assertion library for Python', | ||
@@ -12,0 +12,0 @@ long_description=long_description, |
@@ -76,1 +76,10 @@ # -*- coding: utf-8 -* | ||
| expect(self.lst).to(contain_exactly(be_an(int))) | ||
| with context('when negated'): | ||
| with it('fails when list contains exactly items'): | ||
| with failure("item equal {0!r} found at index 1".format(self.lst[1])): | ||
| expect(self.lst).not_to(contain_exactly(*self.lst)) | ||
| with it('fails when string contains exactly string'): | ||
| with failure("item equal {0!r} found at index 0".format(self.str)): | ||
| expect(self.str).not_to(contain_exactly(self.str)) |
@@ -57,3 +57,12 @@ # -*- coding: utf-8 -* | ||
| with it('fails if list does not have matching items'): | ||
| with failure(''): | ||
| with failure: | ||
| expect(self.lst).to(contain_only(equal('baz'), equal('foo'))) | ||
| with context('when negated'): | ||
| with it('fails if list contains only items'): | ||
| with failure("item equal {0!r} found".format(self.lst[1])): | ||
| expect(self.lst).not_to(contain_only(*self.lst)) | ||
| with it('fails when string contains only string'): | ||
| with failure("item {0!r} found".format(self.str)): | ||
| expect(self.str).not_to(contain_only(self.str)) |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
147371
1.01%2049
1.64%