diff -Nru python-sure-1.2.5/debian/changelog python-sure-1.2.2/debian/changelog --- python-sure-1.2.5/debian/changelog 2014-06-17 15:40:03.000000000 +0000 +++ python-sure-1.2.2/debian/changelog 2014-07-18 16:20:51.000000000 +0000 @@ -1,26 +1,14 @@ -python-sure (1.2.5-2ubuntu1) utopic; urgency=medium +python-sure (1.2.2-2build2) precise; urgency=low - * debian/control: Remove python-rednose and python3-rednose since - its not acutally used. + * No-change backport to precise - -- Chuck Short Tue, 17 Jun 2014 11:39:31 -0400 + -- Lars Butler (larsbutler) Fri, 18 Jul 2014 16:20:31 +0000 -python-sure (1.2.5-2) unstable; urgency=medium +python-sure (1.2.2-2build1) trusty; urgency=medium - * Fixed unfinished first sentence of GPL3 license in debian/copyright, thanks - to Thorsten Alteholz for reporting. (Closes: #744757) + * Rebuild to drop files installed into /usr/share/pyshared. - -- Thomas Goirand Wed, 16 Apr 2014 12:21:18 +0800 - -python-sure (1.2.5-1) unstable; urgency=medium - - * New upstream release. - * Added python-rednose (build-)dependency. - * Added Python3 (and 3.2) support to the package, thanks to Cyril Roelandt. - * Removes the use of embedded copy of six.py. - * Standards-Version is now 3.9.5. - - -- Thomas Goirand Thu, 03 Apr 2014 00:33:28 +0800 + -- Matthias Klose Sun, 23 Feb 2014 13:53:00 +0000 python-sure (1.2.2-2) unstable; urgency=low diff -Nru python-sure-1.2.5/debian/control python-sure-1.2.2/debian/control --- python-sure-1.2.5/debian/control 2014-06-17 15:40:10.000000000 +0000 +++ python-sure-1.2.2/debian/control 2013-12-04 08:53:08.000000000 +0000 @@ -1,21 +1,15 @@ Source: python-sure Section: python Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: PKG OpenStack +Maintainer: PKG OpenStack Uploaders: Julien Danjou , Thomas Goirand , Mehdi Abaakouk Build-Depends: debhelper (>= 9), python-all (>= 2.6.6-3~), python-nose, - python-setuptools, - python-six, - python3-six, - python3-all (>= 3.2), - python3-nose, - python3-setuptools -Standards-Version: 3.9.5 + python-setuptools +Standards-Version: 3.9.4 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=openstack/python-sure.git Vcs-Git: git://anonscm.debian.org/openstack/python-sure.git Homepage: http://github.com/gabrielfalcao/sure @@ -23,31 +17,10 @@ Package: python-sure Architecture: all Pre-Depends: dpkg (>= 1.15.6~) -Depends: python-six, - python-nose, - python-rednose (>= 0.4.1), - ${misc:Depends}, - ${python:Depends} -Description: utility belt for automated testing - Python 2.x +Depends: python-nose, ${misc:Depends}, ${python:Depends} +Recommends: ${python:Recommends} +Description: utility belt for automated testing for Python Sure is a library for Python that leverages a DSL for writing assertions. In CPython it monkey-patches the object type, adding some methods and properties purely for test purposes. Any Python code writen after "import sure" gains testing superpowers. - . - This package contails the module for Python 2.x. - -Package: python3-sure -Architecture: all -Pre-Depends: dpkg (>= 1.15.6~) -Depends: python3-six, - python3-nose, - python3-rednose (>= 0.4.1), - ${misc:Depends}, - ${python3:Depends} -Description: utility belt for automated testing - Python 3.x - Sure is a library for Python that leverages a DSL for writing assertions. In - CPython it monkey-patches the object type, adding some methods and properties - purely for test purposes. Any Python code writen after "import sure" gains - testing superpowers. - . - This package contails the module for Python 3.x. diff -Nru python-sure-1.2.5/debian/copyright python-sure-1.2.2/debian/copyright --- python-sure-1.2.5/debian/copyright 2014-05-03 03:37:41.000000000 +0000 +++ python-sure-1.2.2/debian/copyright 2013-12-04 08:53:08.000000000 +0000 @@ -6,14 +6,6 @@ Copyright: (c) 2013, Thomas Goirand License: GPL-3 -Files: sure/six.py -Copyright: (c) 2010-2013 Benjamin Peterson -License: Expat - -Files: sure/ordereddict.py -Copyright: (c) 2009, Raymond Hettinger -License: Expat - Files: * Copyright: (c) 2010-2013, Gabriel Falcao (c) 2010-2013, Steve Pulec @@ -28,8 +20,7 @@ License: GPL-3 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software - Foundation; either version 3 of the License, or (at your option) any later - version. + Foundation; either version 3 of the License. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS @@ -41,22 +32,3 @@ . On Debian systems, the complete text of the GNU General Public License v2 (GPL) can be found in /usr/share/common-licenses/GPL-3. - -License: Expat - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - . - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. diff -Nru python-sure-1.2.5/debian/patches/adds-support-for-python-3.2.patch python-sure-1.2.2/debian/patches/adds-support-for-python-3.2.patch --- python-sure-1.2.5/debian/patches/adds-support-for-python-3.2.patch 2014-05-03 03:37:41.000000000 +0000 +++ python-sure-1.2.2/debian/patches/adds-support-for-python-3.2.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,818 +0,0 @@ -Description: Add support for Python 3.2 - This patch adds support for Python 3.2. -Author: Cyril Roelandt -Origin: other -Forwarded: no -Last-Update: 2014-04-03 - ---- python-sure-1.2.5.orig/tox.ini -+++ python-sure-1.2.5/tox.ini -@@ -9,5 +9,5 @@ envlist = py26, py27, py33 - [testenv] - commands = nosetests - deps = -- git+git://github.com/spulec/steadymark.git@py3k#egg=sure -+# git+git://github.com/spulec/steadymark.git@py3k#egg=sure - nose ---- python-sure-1.2.5.orig/sure/__init__.py -+++ python-sure-1.2.5/sure/__init__.py -@@ -89,7 +89,7 @@ class VariablesBag(dict): - - - class CallBack(object): -- context_error = u"the function %s defined at %s line %d, is being "\ -+ context_error = "the function %s defined at %s line %d, is being "\ - "decorated by either @that_with_context or @scenario, so it should " \ - "take at least 1 parameter, which is the test context" - -@@ -178,9 +178,9 @@ def within(**units): - except TypeError as e: - if PY3: - # PY3 has different error message -- fmt = u'{0}() takes 0 positional arguments but 1 was given' -+ fmt = '{0}() takes 0 positional arguments but 1 was given' - else: -- fmt = u'{0}() takes no arguments' -+ fmt = '{0}() takes no arguments' - err = text_type(e) - if fmt.format(func.__name__) in err: - func(*args, **kw) -@@ -225,10 +225,10 @@ UNITS = { - ), - } - --milisecond = miliseconds = u'miliseconds' --microsecond = microseconds = u'microseconds' --second = seconds = u'seconds' --minute = minutes = u'minutes' -+milisecond = miliseconds = 'miliseconds' -+microsecond = microseconds = 'microseconds' -+second = seconds = 'seconds' -+minute = minutes = 'minutes' - - - def word_to_number(word): -@@ -299,12 +299,12 @@ def action_for(context, provides=None, d - 'into the context, but it did not. Please double check its ' \ - 'implementation' % (func.__name__, attr) - -- dependency_error_lonely = u'the action "%s" defined at %s:%d ' \ -+ dependency_error_lonely = 'the action "%s" defined at %s:%d ' \ - 'depends on the attribute "%s" to be available in the' \ - ' context. It turns out that there are no actions providing ' \ - 'that. Please double-check the implementation' - -- dependency_error_hints = u'the action "%s" defined at %s:%d ' \ -+ dependency_error_hints = 'the action "%s" defined at %s:%d ' \ - 'depends on the attribute "%s" to be available in the context.'\ - ' You need to call one of the following actions beforehand:\n' - -@@ -538,20 +538,20 @@ class AssertionBuilder(object): - length = len(self.obj) - if self.negative: - assert length > 0, ( -- u"expected `{0}` to not be empty".format(representation)) -+ "expected `{0}` to not be empty".format(representation)) - else: - assert length == 0, ( -- u"expected `{0}` to be empty but it has {1} items".format(representation, length)) -+ "expected `{0}` to be empty but it has {1} items".format(representation, length)) - - return True - - @assertionproperty - def ok(self): - if self.negative: -- msg = u'expected `{0}` to be falsy'.format(self.obj) -+ msg = 'expected `{0}` to be falsy'.format(self.obj) - assert not bool(self.obj), msg - else: -- msg = u'expected `{0}` to be truthy'.format(self.obj) -+ msg = 'expected `{0}` to be truthy'.format(self.obj) - assert bool(self.obj), msg - - return True -@@ -562,10 +562,10 @@ class AssertionBuilder(object): - @assertionproperty - def falsy(self): - if self.negative: -- msg = u'expected `{0}` to be truthy'.format(self.obj) -+ msg = 'expected `{0}` to be truthy'.format(self.obj) - assert bool(self.obj), msg - else: -- msg = u'expected `{0}` to be falsy'.format(self.obj) -+ msg = 'expected `{0}` to be falsy'.format(self.obj) - assert not bool(self.obj), msg - - return True -@@ -644,9 +644,9 @@ class AssertionBuilder(object): - first = '_abcoll' - else: - if sys.version_info <= (3, 0, 0): -- first = u'__builtin__' -+ first = '__builtin__' - else: -- first = u'builtins' -+ first = 'builtins' - items = [klass] - - klass = reduce(getattr, items, __import__(first)) -@@ -669,13 +669,13 @@ class AssertionBuilder(object): - @assertionmethod - def greater_than(self, dest): - if self.negative: -- msg = u"expected `{0}` to not be greater than `{1}`".format( -+ msg = "expected `{0}` to not be greater than `{1}`".format( - self.obj, dest) - - assert not self.obj > dest, msg - - else: -- msg = u"expected `{0}` to be greater than `{1}`".format( -+ msg = "expected `{0}` to be greater than `{1}`".format( - self.obj, dest) - assert self.obj > dest, msg - -@@ -684,13 +684,13 @@ class AssertionBuilder(object): - @assertionmethod - def greater_than_or_equal_to(self, dest): - if self.negative: -- msg = u"expected `{0}` to not be greater than or equal to `{1}`".format( -+ msg = "expected `{0}` to not be greater than or equal to `{1}`".format( - self.obj, dest) - - assert not self.obj >= dest, msg - - else: -- msg = u"expected `{0}` to be greater than or equal to `{1}`".format( -+ msg = "expected `{0}` to be greater than or equal to `{1}`".format( - self.obj, dest) - assert self.obj >= dest, msg - -@@ -699,13 +699,13 @@ class AssertionBuilder(object): - @assertionmethod - def lower_than(self, dest): - if self.negative: -- msg = u"expected `{0}` to not be lower than `{1}`".format( -+ msg = "expected `{0}` to not be lower than `{1}`".format( - self.obj, dest) - - assert not self.obj < dest, msg - - else: -- msg = u"expected `{0}` to be lower than `{1}`".format( -+ msg = "expected `{0}` to be lower than `{1}`".format( - self.obj, dest) - assert self.obj < dest, msg - -@@ -714,13 +714,13 @@ class AssertionBuilder(object): - @assertionmethod - def lower_than_or_equal_to(self, dest): - if self.negative: -- msg = u"expected `{0}` to not be lower than or equal to `{1}`".format( -+ msg = "expected `{0}` to not be lower than or equal to `{1}`".format( - self.obj, dest) - - assert not self.obj <= dest, msg - - else: -- msg = u"expected `{0}` to be lower than or equal to `{1}`".format( -+ msg = "expected `{0}` to be lower than or equal to `{1}`".format( - self.obj, dest) - assert self.obj <= dest, msg - -@@ -729,10 +729,10 @@ class AssertionBuilder(object): - @assertionmethod - def below(self, num): - if self.negative: -- msg = u"{0} should not be below {1}".format(self.obj, num) -+ msg = "{0} should not be below {1}".format(self.obj, num) - assert not self.obj < num, msg - else: -- msg = u"{0} should be below {1}".format(self.obj, num) -+ msg = "{0} should be below {1}".format(self.obj, num) - assert self.obj < num, msg - - return True -@@ -740,10 +740,10 @@ class AssertionBuilder(object): - @assertionmethod - def above(self, num): - if self.negative: -- msg = u"{0} should not be above {1}".format(self.obj, num) -+ msg = "{0} should not be above {1}".format(self.obj, num) - assert not self.obj > num, msg - else: -- msg = u"{0} should be above {1}".format(self.obj, num) -+ msg = "{0} should be above {1}".format(self.obj, num) - assert self.obj > num, msg - return True - -@@ -769,7 +769,7 @@ class AssertionBuilder(object): - and_kwargs=self._callable_kw) - - if self.negative: -- msg = (u"{0} called with args {1} and kwargs {2} should " -+ msg = ("{0} called with args {1} and kwargs {2} should " - "not raise {3} but raised {4}") - - exc = args and args[0] or Exception ---- python-sure-1.2.5.orig/sure/core.py -+++ python-sure-1.2.5/sure/core.py -@@ -129,7 +129,7 @@ class DeepComparison(object): - if X == Y: - return True - else: -- m = u'X%s != Y%s' % (red(c.current_X_keys), green(c.current_Y_keys)) -+ m = 'X%s != Y%s' % (red(c.current_X_keys), green(c.current_Y_keys)) - return DeepExplanation(m) - - def compare_dicts(self, X, Y): -@@ -141,14 +141,14 @@ class DeepComparison(object): - diff_x = list(set(x_keys).difference(set(y_keys))) - diff_y = list(set(y_keys).difference(set(x_keys))) - if diff_x: -- msg = u"X%s has the key %%r whereas Y%s does not" % ( -+ msg = "X%s has the key %%r whereas Y%s does not" % ( - red(c.current_X_keys), - green(c.current_Y_keys), - ) % diff_x[0] - return DeepExplanation(msg) - - elif diff_y: -- msg = u"X%s does not have the key %%r whereas Y%s has it" % ( -+ msg = "X%s does not have the key %%r whereas Y%s has it" % ( - red(c.current_X_keys), - green(c.current_Y_keys), - ) % diff_y[0] -@@ -201,10 +201,10 @@ class DeepComparison(object): - def compare_iterables(self, X, Y): - len_X, len_Y = map(len, (X, Y)) - if len_X > len_Y: -- msg = u"X has %d items whereas Y has only %d" % (len_X, len_Y) -+ msg = "X has %d items whereas Y has only %d" % (len_X, len_Y) - return DeepExplanation(msg) - elif len_X < len_Y: -- msg = u"Y has %d items whereas X has only %d" % (len_Y, len_X) -+ msg = "Y has %d items whereas X has only %d" % (len_Y, len_X) - return DeepExplanation(msg) - elif X == Y: - return True -@@ -226,13 +226,13 @@ class DeepComparison(object): - if X == Y: - return True - c = self.get_context() -- m = u"X%s is %%r whereas Y%s is %%r" -+ m = "X%s is %%r whereas Y%s is %%r" - msg = m % (red(c.current_X_keys), green(c.current_Y_keys)) % (X, Y) - return DeepExplanation(msg) - - elif type(X) is not type(Y): # different types - xname, yname = map(lambda _: type(_).__name__, (X, Y)) -- msg = u'X%s is a %%s and Y%s is a %%s instead' % ( -+ msg = 'X%s is a %%s and Y%s is a %%s instead' % ( - red(c.current_X_keys), - green(c.current_Y_keys), - ) % (xname, yname) ---- python-sure-1.2.5.orig/sure/old.py -+++ python-sure-1.2.5/sure/old.py -@@ -177,7 +177,7 @@ class AssertionHelper(object): - - def equals(self, dst): - if self._attribute and is_iterable(self._src): -- msg = u'%r[%d].%s should be %r, but is %r' -+ msg = '%r[%d].%s should be %r, but is %r' - - for index, item in enumerate(self._src): - if self._range: -@@ -199,12 +199,12 @@ class AssertionHelper(object): - old_dst = pformat(dst) - self._src = re.sub(r'\s', '', self._src).lower() - dst = re.sub(r'\s', '', dst).lower() -- error = u'%s does not look like %s' % (old_src, old_dst) -+ error = '%s does not look like %s' % (old_src, old_dst) - assert self._src == dst, error - return self._src == dst - - def every_one_is(self, dst): -- msg = u'all members of %r should be %r, but the %dth is %r' -+ msg = 'all members of %r should be %r, but the %dth is %r' - for index, item in enumerate(self._src): - if self._range: - if index < self._range[0] or index > self._range[1]: -@@ -248,7 +248,7 @@ class AssertionHelper(object): - length = len(self._src) - - if length <= that: -- error = u'the length of the %s should be greater then %d, but is %d' % ( -+ error = 'the length of the %s should be greater then %d, but is %d' % ( - type(self._src).__name__, - that, - length, -@@ -263,7 +263,7 @@ class AssertionHelper(object): - length = len(self._src) - - if length < that: -- error = u'the length of %r should be greater then or equals %d, but is %d' % ( -+ error = 'the length of %r should be greater then or equals %d, but is %d' % ( - self._src, - that, - length, -@@ -281,7 +281,7 @@ class AssertionHelper(object): - length = len(self._src) - - if length >= that: -- error = u'the length of %r should be lower then %r, but is %d' % ( -+ error = 'the length of %r should be lower then %r, but is %d' % ( - self._src, - original_that, - length, -@@ -294,7 +294,7 @@ class AssertionHelper(object): - that = self._get_that(that) - - length = len(self._src) -- error = u'the length of %r should be lower then or equals %d, but is %d' -+ error = 'the length of %r should be lower then or equals %d, but is %d' - - if length > that: - msg = error % ( -@@ -311,7 +311,7 @@ class AssertionHelper(object): - length = len(self._src) - - if length != that: -- error = u'the length of %r should be %d, but is %d' % ( -+ error = 'the length of %r should be %d, but is %d' % ( - self._src, - that, - length, -@@ -325,7 +325,7 @@ class AssertionHelper(object): - length = len(self._src) - - if length == that: -- error = u'the length of %r should not be %d' % ( -+ error = 'the length of %r should not be %d' % ( - self._src, - that, - ) -@@ -345,7 +345,7 @@ class AssertionHelper(object): - return self - - def matches(self, items): -- msg = u'%r[%d].%s should be %r, but is %r' -+ msg = '%r[%d].%s should be %r, but is %r' - get_eval = lambda item: eval( - "%s.%s" % ('current', self._eval), {}, {'current': item}, - ) ---- python-sure-1.2.5.orig/tests/test_safe_repr.py -+++ python-sure-1.2.5/tests/test_safe_repr.py -@@ -10,7 +10,7 @@ from sure.six import compat_repr, PY3 - - def test_basic_list(): - "safe_repr should display a simple list" -- X = [u'one', u'yeah'] -+ X = ['one', 'yeah'] - expect(safe_repr(X)).should.equal(compat_repr( - "['one', 'yeah']" - )) -@@ -18,7 +18,7 @@ def test_basic_list(): - - def test_basic_dict(): - "safe_repr should return a sorted repr" -- X = {u'b': u'd', u'a': u'c'} -+ X = {'b': 'd', 'a': 'c'} - expect(safe_repr(X)).should.equal(compat_repr( - "{'a': 'c', 'b': 'd'}" - )) -@@ -26,7 +26,7 @@ def test_basic_dict(): - - def test_nested_dict(): - "dicts nested inside values should also get sorted" -- X = {u'my::all_users': [{u'age': 33, u'name': u'John', u'foo': u'bar'}]} -+ X = {'my::all_users': [{'age': 33, 'name': 'John', 'foo': 'bar'}]} - expect(safe_repr(X)).should.equal(compat_repr( - '''{'my::all_users': [{'age': 33, 'foo': 'bar', 'name': 'John'}]}''' - )) -@@ -50,10 +50,10 @@ def test_unicode(): - - y1 = { - 'a': 2, -- 'b': Y(u'Gabriel Falcão'), -- 'c': u'Foo', -+ 'b': Y('Gabriel Falcão'), -+ 'c': 'Foo', - } -- name = u'Gabriel Falcão' if PY3 else u'Gabriel Falc\xe3o' -+ name = 'Gabriel Falcão' if PY3 else 'Gabriel Falc\xe3o' - - expect(safe_repr(y1)).should.equal(compat_repr( - "{'a': 2, 'b': %s, 'c': 'Foo'}" % name ---- python-sure-1.2.5.orig/tests/test_assertion_builder.py -+++ python-sure-1.2.5/tests/test_assertion_builder.py -@@ -22,7 +22,7 @@ from sure.six import PY3, compat_repr - - - def test_assertion_builder_synonyms(): -- (u"this, it, these and those are all synonyms") -+ ("this, it, these and those are all synonyms") - - assert isinstance(it, AssertionBuilder) - assert isinstance(this, AssertionBuilder) -@@ -31,7 +31,7 @@ def test_assertion_builder_synonyms(): - - - def test_4_equal_2p2(): -- (u"this(4).should.equal(2 + 2)") -+ ("this(4).should.equal(2 + 2)") - - time = datetime.now() - -@@ -53,7 +53,7 @@ def test_4_equal_2p2(): - - - def test_2_within_0a2(): -- (u"this(1).should.be.within(0, 2)") -+ ("this(1).should.be.within(0, 2)") - - assert this(1).should.be.within(0, 2) - assert this(4).should_not.be.within(0, 2) -@@ -72,7 +72,7 @@ def test_2_within_0a2(): - - - def test_true_be_ok(): -- (u"this(True).should.be.ok") -+ ("this(True).should.be.ok") - - assert this(True).should.be.ok - assert this(False).should_not.be.ok -@@ -91,7 +91,7 @@ def test_true_be_ok(): - - - def test_false_be_falsy(): -- (u"this(False).should.be.false") -+ ("this(False).should.be.false") - - assert this(False).should.be.falsy - assert this(True).should_not.be.falsy -@@ -110,7 +110,7 @@ def test_false_be_falsy(): - - - def test_none(): -- (u"this(None).should.be.none") -+ ("this(None).should.be.none") - - assert this(None).should.be.none - assert this(not None).should_not.be.none -@@ -129,7 +129,7 @@ def test_none(): - - - def test_should_be_a(): -- (u"this(None).should.be.none") -+ ("this(None).should.be.none") - - assert this(1).should.be.an(int) - assert this([]).should.be.a('collections.Iterable') -@@ -149,7 +149,7 @@ def test_should_be_a(): - - - def test_should_be_callable(): -- (u"this(function).should.be.callable") -+ ("this(function).should.be.callable") - - assert this(lambda: None).should.be.callable - assert this("aa").should_not.be.callable -@@ -170,7 +170,7 @@ def test_should_be_callable(): - - - def test_iterable_should_be_empty(): -- (u"this(iterable).should.be.empty") -+ ("this(iterable).should.be.empty") - - assert this([]).should.be.empty - assert this([1, 2, 3]).should_not.be.empty -@@ -190,7 +190,7 @@ def test_iterable_should_be_empty(): - - - def test_iterable_should_have_length_of(): -- (u"this(iterable).should.have.length_of(N)") -+ ("this(iterable).should.have.length_of(N)") - - assert this({'foo': 'bar', 'a': 'b'}).should.have.length_of(2) - assert this([1, 2, 3]).should_not.have.length_of(4) -@@ -211,7 +211,7 @@ def test_iterable_should_have_length_of( - - - def test_greater_than(): -- (u"this(X).should.be.greater_than(Y)") -+ ("this(X).should.be.greater_than(Y)") - - assert this(5).should.be.greater_than(4) - assert this(1).should_not.be.greater_than(2) -@@ -232,7 +232,7 @@ def test_greater_than(): - - - def test_greater_than_or_equal_to(): -- (u"this(X).should.be.greater_than_or_equal_to(Y)") -+ ("this(X).should.be.greater_than_or_equal_to(Y)") - - assert this(4).should.be.greater_than_or_equal_to(4) - assert this(1).should_not.be.greater_than_or_equal_to(2) -@@ -253,7 +253,7 @@ def test_greater_than_or_equal_to(): - - - def test_lower_than(): -- (u"this(X).should.be.lower_than(Y)") -+ ("this(X).should.be.lower_than(Y)") - - assert this(4).should.be.lower_than(5) - assert this(2).should_not.be.lower_than(1) -@@ -274,7 +274,7 @@ def test_lower_than(): - - - def test_lower_than_or_equal_to(): -- (u"this(X).should.be.lower_than_or_equal_to(Y)") -+ ("this(X).should.be.lower_than_or_equal_to(Y)") - - assert this(5).should.be.lower_than_or_equal_to(5) - assert this(2).should_not.be.lower_than_or_equal_to(1) -@@ -295,7 +295,7 @@ def test_lower_than_or_equal_to(): - - - def test_be(): -- (u"this(X).should.be(X) when X is a reference to the same object") -+ ("this(X).should.be(X) when X is a reference to the same object") - - d1 = {} - d2 = d1 -@@ -322,7 +322,7 @@ def test_be(): - - - def test_have_property(): -- (u"this(instance).should.have.property(property_name)") -+ ("this(instance).should.have.property(property_name)") - - class Person(object): - name = "John Doe" -@@ -351,7 +351,7 @@ def test_have_property(): - - - def test_have_property_with_value(): -- (u"this(instance).should.have.property(property_name).being or " -+ ("this(instance).should.have.property(property_name).being or " - ".with_value should allow chain up") - - class Person(object): -@@ -383,7 +383,7 @@ def test_have_property_with_value(): - - - def test_have_key(): -- (u"this(dictionary).should.have.key(key_name)") -+ ("this(dictionary).should.have.key(key_name)") - - jay = {'name': "John Doe"} - -@@ -407,7 +407,7 @@ def test_have_key(): - - - def test_have_key_with_value(): -- (u"this(dictionary).should.have.key(key_name).being or " -+ ("this(dictionary).should.have.key(key_name).being or " - ".with_value should allow chain up") - - jay = dict(name="John Doe") -@@ -433,7 +433,7 @@ def test_have_key_with_value(): - - - def test_look_like(): -- (u"this(' aa \n ').should.look_like('aa')") -+ ("this(' aa \n ').should.look_like('aa')") - - assert this(' \n aa \n ').should.look_like('AA') - assert this(' \n bb \n ').should_not.look_like('aa') -@@ -452,7 +452,7 @@ def test_look_like(): - - - def test_equal_with_repr_of_complex_types_and_unicode(): -- (u"test usage of repr() inside expect(complex1).to.equal(complex2)") -+ ("test usage of repr() inside expect(complex1).to.equal(complex2)") - - class Y(object): - def __init__(self, x): -@@ -470,19 +470,19 @@ def test_equal_with_repr_of_complex_type - - y1 = dict( - a=2, -- b=Y(u'Gabriel Falcão'), -+ b=Y('Gabriel Falcão'), - c='Foo', - ) - - expect(y1).to.equal(dict( - a=2, -- b=Y(u'Gabriel Falcão'), -+ b=Y('Gabriel Falcão'), - c='Foo', - )) - - - def test_equal_with_repr_of_complex_types_and_repr(): -- (u"test usage of repr() inside expect(complex1).to.equal(complex2)") -+ ("test usage of repr() inside expect(complex1).to.equal(complex2)") - - class Y(object): - def __init__(self, x): -@@ -500,33 +500,33 @@ def test_equal_with_repr_of_complex_type - - y1 = { - 'a': 2, -- 'b': Y(u'Gabriel Falcão'), -+ 'b': Y('Gabriel Falcão'), - 'c': 'Foo', - } - - expect(y1).to.equal({ - 'a': 2, -- 'b': Y(u'Gabriel Falcão'), -+ 'b': Y('Gabriel Falcão'), - 'c': 'Foo', - }) - - expect(y1).to_not.equal({ - 'a': 2, -- 'b': Y(u'Gabriel Falçao'), -+ 'b': Y('Gabriel Falçao'), - 'c': 'Foo', - }) - - def opposite(): - expect(y1).to.equal({ - 'a': 2, -- 'b': Y(u'Gabriel Falçao'), -+ 'b': Y('Gabriel Falçao'), - 'c': 'Foo', - }) - - def opposite_not(): - expect(y1).to_not.equal({ - 'a': 2, -- 'b': Y(u'Gabriel Falcão'), -+ 'b': Y('Gabriel Falcão'), - 'c': 'Foo', - }) - -@@ -535,11 +535,11 @@ def test_equal_with_repr_of_complex_type - - expect(opposite_not).when.called.to.throw(AssertionError) - expect(opposite_not).when.called.to.throw(compat_repr( -- u"{'a': 2, 'b': Gabriel Falcão, 'c': 'Foo'} should differ to {'a': 2, 'b': Gabriel Falcão, 'c': 'Foo'}, but is the same thing")) -+ "{'a': 2, 'b': Gabriel Falcão, 'c': 'Foo'} should differ to {'a': 2, 'b': Gabriel Falcão, 'c': 'Foo'}, but is the same thing")) - - - def test_match_regex(): -- (u"expect('some string').to.match(r'\w{4} \w{6}') matches regex") -+ ("expect('some string').to.match(r'\w{4} \w{6}') matches regex") - - assert this("some string").should.match(r"\w{4} \w{6}") - assert this("some string").should_not.match(r"^\d*$") -@@ -560,7 +560,7 @@ def test_match_regex(): - - - def test_match_contain(): -- (u"expect('some string').to.contain('tri')") -+ ("expect('some string').to.contain('tri')") - - assert this("some string").should.contain("tri") - assert this("some string").should_not.contain('foo') ---- python-sure-1.2.5.orig/tests/test_old_api.py -+++ python-sure-1.2.5/tests/test_old_api.py -@@ -524,7 +524,7 @@ def test_that_contains_none(): - - assert that(assertions).raises( - TypeError, -- u"'in ' requires string as left operand, not NoneType", -+ "'in ' requires string as left operand, not NoneType", - ) - - -@@ -537,7 +537,7 @@ def test_that_none_contains_string(): - except Exception as e: - assert_equals( - text_type(e), -- u"argument of type 'NoneType' is not iterable", -+ "argument of type 'NoneType' is not iterable", - ) - - -@@ -621,7 +621,7 @@ def test_within_fail(): - import time - from sure import within, miliseconds - -- def sleepy(): -+ def sleepy(*a): - time.sleep(0.7) - - failed = False -@@ -727,7 +727,7 @@ def test_within_pass_utc(): - - - def test_that_is_a_matcher_should_absorb_callables_to_be_used_as_matcher(): -- u"that.is_a_matcher should absorb callables to be used as matcher" -+ "that.is_a_matcher should absorb callables to be used as matcher" - @that.is_a_matcher - def is_truthful(what): - assert bool(what), '%s is so untrue' % (what) -@@ -1439,15 +1439,15 @@ def test_deep_equals_dict_level3_fails_d - "that() deep_equals(dict) failing on level 3 when has an extra key" - - something = { -- u'my::all_users': [ -- {u'name': u'John', u'age': 33, u'foo': u'bar'}, -+ 'my::all_users': [ -+ {'name': 'John', 'age': 33, 'foo': 'bar'}, - ], - } - - def assertions(): - assert that(something).deep_equals({ -- u'my::all_users': [ -- {u'name': u'John', u'age': 33, u'bar': u'foo'}, -+ 'my::all_users': [ -+ {'name': 'John', 'age': 33, 'bar': 'foo'}, - ], - }) - -@@ -1482,7 +1482,7 @@ def test_deep_equals_list_level2_fail_by - def test_deep_equals_list_level2_fail_by_length_y_gt_x(): - "that(list) deep_equals(list) failing by length (len(Y) > len(X))" - -- something = [u'one', u'yeah'] -+ something = ['one', 'yeah'] - - def assertions(): - assert that(something).deep_equals(['one', 'yeah', 'damn']) -@@ -1513,10 +1513,10 @@ def test_function_decorated_with_wip_sho - def test_that_equals_fails(): - "that() equals(string) when it's supposed to fail" - -- something = u"else" -+ something = "else" - - def fail(): -- assert that(u'something').equals(something) -+ assert that('something').equals(something) - - assert that(fail).raises( - AssertionError, compat_repr( -@@ -1549,9 +1549,9 @@ def test_deep_equals_weird(): - part1 = [ - ('Bootstraping Redis role', []), - ('Restart scalarizr', []), -- ('Rebundle server', [u'rebundle']), -- ('Use new role', [u'rebundle']), -- ('Restart scalarizr after bundling', [u'rebundle']), -+ ('Rebundle server', ['rebundle']), -+ ('Use new role', ['rebundle']), -+ ('Restart scalarizr after bundling', ['rebundle']), - ('Bundling data', []), - ('Modifying data', []), - ('Reboot server', []), -@@ -1559,19 +1559,19 @@ def test_deep_equals_weird(): - ('Setup replication', []), - ('Restart scalarizr in slave', []), - ('Slave force termination', []), -- ('Slave delete EBS', [u'ec2']), -- ('Setup replication for EBS test', [u'ec2']), -+ ('Slave delete EBS', ['ec2']), -+ ('Setup replication for EBS test', ['ec2']), - ('Writing on Master, reading on Slave', []), - ('Slave -> Master promotion', []), -- ('Restart farm', [u'restart_farm']), -+ ('Restart farm', ['restart_farm']), - ] - - part2 = [ -- ('Bootstraping Redis role', [u'rebundle', u'rebundle', u'rebundle']), -+ ('Bootstraping Redis role', ['rebundle', 'rebundle', 'rebundle']), - ('Restart scalarizr', []), -- ('Rebundle server', [u'rebundle']), -- ('Use new role', [u'rebundle']), -- ('Restart scalarizr after bundling', [u'rebundle']), -+ ('Rebundle server', ['rebundle']), -+ ('Use new role', ['rebundle']), -+ ('Restart scalarizr after bundling', ['rebundle']), - ('Bundling data', []), - ('Modifying data', []), - ('Reboot server', []), -@@ -1579,11 +1579,11 @@ def test_deep_equals_weird(): - ('Setup replication', []), - ('Restart scalarizr in slave', []), - ('Slave force termination', []), -- ('Slave delete EBS', [u'ec2']), -- ('Setup replication for EBS test', [u'ec2']), -+ ('Slave delete EBS', ['ec2']), -+ ('Setup replication for EBS test', ['ec2']), - ('Writing on Master, reading on Slave', []), - ('Slave -> Master promotion', []), -- ('Restart farm', [u'restart_farm']), -+ ('Restart farm', ['restart_farm']), - ] - - expect(that(part1).equals).when.called_with(part2).should.throw("") diff -Nru python-sure-1.2.5/debian/patches/fix-broken-setup.py.patch python-sure-1.2.2/debian/patches/fix-broken-setup.py.patch --- python-sure-1.2.5/debian/patches/fix-broken-setup.py.patch 2014-05-03 03:37:41.000000000 +0000 +++ python-sure-1.2.2/debian/patches/fix-broken-setup.py.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -Description: Fixes broken setup.py - The upstream setup.py didn't work with sure/__init__.py which has some - UTF-8. The result is that without an UTF-8 local, setup.py install would - just fail with the output: - UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 143: ordinal not in range(128) - This patch fixes that. -Author: victor stinner -Origin: other -Forwarded: no -Last-Update: 2014-04-03 - ---- python-sure-1.2.5.orig/setup.py -+++ python-sure-1.2.5/setup.py -@@ -38,7 +38,9 @@ class VersionFinder(ast.NodeVisitor): - def read_version(): - """Read version from sure/version.py without loading any files""" - finder = VersionFinder() -- finder.visit(ast.parse(local_file('sure', '__init__.py'))) -+ filename = os.path.join(os.path.dirname(__file__), 'sure', '__init__.py') -+ with open(filename, 'rb') as fp: -+ finder.visit(ast.parse(fp.read())) - return finder.version - - diff -Nru python-sure-1.2.5/debian/patches/removes-embedded-copy-of-six.patch python-sure-1.2.2/debian/patches/removes-embedded-copy-of-six.patch --- python-sure-1.2.5/debian/patches/removes-embedded-copy-of-six.patch 2014-05-03 03:37:41.000000000 +0000 +++ python-sure-1.2.2/debian/patches/removes-embedded-copy-of-six.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,625 +0,0 @@ -Description: Remove the embedded copy of six. -Date: Wed, 2 Apr 2014 14:27:38 +0200 -Author: Cyril Roelandt -Origin: other -Forwarded: no -Last-Update: 2014-04-03 - ---- python-sure-1.2.5.orig/OLD_API.md -+++ python-sure-1.2.5/OLD_API.md -@@ -17,7 +17,7 @@ a assertion toolbox that works fine with - - ```python - from sure.deprecated import that --from sure.six import PY3 -+from six import PY3 - - if PY3: - assert that("something").is_a(str) ---- python-sure-1.2.5.orig/requirements.txt -+++ python-sure-1.2.5/requirements.txt -@@ -1,2 +1,3 @@ - nose==1.3.0 - rednose==0.4.1 -+six ---- python-sure-1.2.5.orig/spec/reference.md -+++ python-sure-1.2.5/spec/reference.md -@@ -243,7 +243,7 @@ exception: - - ```python - import sure --from sure.six import PY3 -+from six import PY3 - - if PY3: - range.when.called_with(10, step=20).should.throw(TypeError, "range() does not take keyword arguments") -@@ -296,7 +296,7 @@ this takes the class (type) itself and c - - ```python - import sure --from sure.six import PY3 -+from six import PY3 - - if PY3: - u"".should.be.an(str) ---- /dev/null -+++ python-sure-1.2.5/sure/compat_py3.py -@@ -0,0 +1,29 @@ -+import six -+ -+if six.PY3: -+ def compat_repr(object_repr): -+ return object_repr -+else: -+ def compat_repr(object_repr): -+ # compat_repr is designed to return all reprs with leading 'u's -+ # inserted to make all strings look like unicode strings. -+ # This makes testing between py2 and py3 much easier. -+ result = '' -+ in_quote = False -+ curr_quote = None -+ for char in object_repr: -+ if char in ['"', "'"] and ( -+ not curr_quote or char == curr_quote): -+ if in_quote: -+ # Closing quote -+ curr_quote = None -+ in_quote = False -+ else: -+ # Opening quote -+ curr_quote = char -+ result += 'u' -+ in_quote = True -+ result += char -+ return result -+ -+text_type_name = six.text_type().__class__.__name__ ---- python-sure-1.2.5.orig/sure/__init__.py -+++ python-sure-1.2.5/sure/__init__.py -@@ -27,6 +27,9 @@ import traceback - from functools import wraps - from datetime import datetime - -+from six import string_types, text_type, PY3, get_function_code -+from six.moves import reduce -+ - from sure.old import AssertionHelper - from sure.old import Iterable - from sure.old import builtins -@@ -39,8 +42,6 @@ from sure.core import safe_repr - - from sure.magic import is_cpython, patchable_builtin - from sure.registry import context as _registry --from sure.six import string_types, text_type, PY3, get_function_code --from sure.six.moves import reduce - - - if PY3: ---- python-sure-1.2.5.orig/sure/core.py -+++ python-sure-1.2.5/sure/core.py -@@ -24,11 +24,11 @@ except ImportError: - - import os - import inspect --from sure.terminal import red, green, yellow --from sure.six import ( -+from six import ( - text_type, integer_types, string_types, binary_type, - PY3, get_function_code - ) -+from sure.terminal import red, green, yellow - - - class FakeOrderedDict(OrderedDict): ---- python-sure-1.2.5.orig/sure/old.py -+++ python-sure-1.2.5/sure/old.py -@@ -33,11 +33,12 @@ try: - except ImportError: - import builtins - -+from six import string_types, text_type -+ - from sure.core import DeepComparison - from sure.core import _get_file_name - from sure.core import _get_line_number - from sure.core import itemize_length --from sure.six import string_types, text_type - - - def is_iterable(obj): ---- python-sure-1.2.5.orig/tests/test_safe_repr.py -+++ python-sure-1.2.5/tests/test_safe_repr.py -@@ -3,9 +3,11 @@ - - from __future__ import unicode_literals - -+from six import PY3 -+ - from sure import expect - from sure.core import safe_repr --from sure.six import compat_repr, PY3 -+from sure.compat_py3 import compat_repr - - - def test_basic_list(): ---- python-sure-1.2.5.orig/tests/test_assertion_builder.py -+++ python-sure-1.2.5/tests/test_assertion_builder.py -@@ -17,8 +17,9 @@ - # along with this program. If not, see . - from __future__ import unicode_literals - from datetime import datetime -+from six import PY3 - from sure import this, these, those, it, expect, AssertionBuilder --from sure.six import PY3, compat_repr -+from sure.compat_py3 import compat_repr - - - def test_assertion_builder_synonyms(): ---- python-sure-1.2.5.orig/tests/test_old_api.py -+++ python-sure-1.2.5/tests/test_old_api.py -@@ -17,12 +17,14 @@ - # along with this program. If not, see . - from __future__ import unicode_literals - -+from six import text_type, PY3 -+from six.moves import xrange -+ - import sure - from sure.deprecated import that - from sure import VariablesBag, expect - from nose.tools import assert_equals, assert_raises --from sure.six import text_type, text_type_name, compat_repr, PY3 --from sure.six.moves import xrange -+from sure.compat_py3 import compat_repr, text_type_name - - - def test_setup_with_context(): -@@ -55,7 +57,7 @@ def test_context_is_not_optional(): - - assert that(it_crashes).raises( - TypeError, ( -- "the function it_crashes defined at test_old_api.py line 53, is being " -+ "the function it_crashes defined at test_old_api.py line 55, is being " - "decorated by either @that_with_context or @scenario, so it should " - "take at least 1 parameter, which is the test context"), - ) -@@ -889,7 +891,7 @@ def test_depends_on_failing_due_nothing_ - from sure import action_for, scenario - - fullpath = os.path.abspath(__file__).replace('.pyc', '.py') -- error = 'the action "lonely_action" defined at %s:898 ' \ -+ error = 'the action "lonely_action" defined at %s:900 ' \ - 'depends on the attribute "something" to be available in the' \ - ' context. It turns out that there are no actions providing ' \ - 'that. Please double-check the implementation' % fullpath -@@ -915,10 +917,10 @@ def test_depends_on_failing_due_not_call - from sure import action_for, scenario - - fullpath = os.path.abspath(__file__).replace('.pyc', '.py') -- error = 'the action "my_action" defined at {0}:928 ' \ -+ error = 'the action "my_action" defined at {0}:930 ' \ - 'depends on the attribute "some_attr" to be available in the context.'\ - ' You need to call one of the following actions beforehand:\n' \ -- ' -> dependency_action at {0}:924'.replace('{0}', fullpath) -+ ' -> dependency_action at {0}:926'.replace('{0}', fullpath) - - def with_setup(context): - @action_for(context, provides=['some_attr']) ---- python-sure-1.2.5.orig/sure/six.py 2014-02-08 01:44:49.000000000 +0800 -+++ /dev/null 2014-03-22 14:42:39.437744719 +0800 -@@ -1,415 +0,0 @@ --"""Utilities for writing code that runs on Python 2 and 3""" -- --# Copyright (c) 2010-2013 Benjamin Peterson --# --# Permission is hereby granted, free of charge, to any person obtaining a copy of --# this software and associated documentation files (the "Software"), to deal in --# the Software without restriction, including without limitation the rights to --# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of --# the Software, and to permit persons to whom the Software is furnished to do so, --# subject to the following conditions: --# --# The above copyright notice and this permission notice shall be included in all --# copies or substantial portions of the Software. --# --# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS --# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR --# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER --# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN --# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- --import operator --import sys --import types -- --__author__ = "Benjamin Peterson " --__version__ = "1.2.0" -- -- --# True if we are running on Python 3. --PY3 = sys.version_info[0] == 3 -- --if PY3: -- string_types = str, -- integer_types = int, -- class_types = type, -- text_type = str -- binary_type = bytes -- -- MAXSIZE = sys.maxsize --else: -- string_types = basestring, -- integer_types = (int, long) -- class_types = (type, types.ClassType) -- text_type = unicode -- binary_type = str -- -- if sys.platform.startswith("java"): -- # Jython always uses 32 bits. -- MAXSIZE = int((1 << 31) - 1) -- else: -- # It's possible to have sizeof(long) != sizeof(Py_ssize_t). -- class X(object): -- def __len__(self): -- return 1 << 31 -- try: -- len(X()) -- except OverflowError: -- # 32-bit -- MAXSIZE = int((1 << 31) - 1) -- else: -- # 64-bit -- MAXSIZE = int((1 << 63) - 1) -- del X -- --text_type_name = text_type().__class__.__name__ -- -- --def _add_doc(func, doc): -- """Add documentation to a function.""" -- func.__doc__ = doc -- -- --def _import_module(name): -- """Import module, returning the module after the last dot.""" -- __import__(name) -- return sys.modules[name] -- -- --class _LazyDescr(object): -- -- def __init__(self, name): -- self.name = name -- -- def __get__(self, obj, tp): -- result = self._resolve() -- setattr(obj, self.name, result) -- # This is a bit ugly, but it avoids running this again. -- delattr(tp, self.name) -- return result -- -- --class MovedModule(_LazyDescr): -- -- def __init__(self, name, old, new=None): -- super(MovedModule, self).__init__(name) -- if PY3: -- if new is None: -- new = name -- self.mod = new -- else: -- self.mod = old -- -- def _resolve(self): -- return _import_module(self.mod) -- -- --class MovedAttribute(_LazyDescr): -- -- def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): -- super(MovedAttribute, self).__init__(name) -- if PY3: -- if new_mod is None: -- new_mod = name -- self.mod = new_mod -- if new_attr is None: -- if old_attr is None: -- new_attr = name -- else: -- new_attr = old_attr -- self.attr = new_attr -- else: -- self.mod = old_mod -- if old_attr is None: -- old_attr = name -- self.attr = old_attr -- -- def _resolve(self): -- module = _import_module(self.mod) -- return getattr(module, self.attr) -- -- -- --class _MovedItems(types.ModuleType): -- """Lazy loading of moved objects""" -- -- --_moved_attributes = [ -- MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), -- MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), -- MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), -- MovedAttribute("map", "itertools", "builtins", "imap", "map"), -- MovedAttribute("reload_module", "__builtin__", "imp", "reload"), -- MovedAttribute("reduce", "__builtin__", "functools"), -- MovedAttribute("StringIO", "StringIO", "io"), -- MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), -- MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), -- -- MovedModule("builtins", "__builtin__"), -- MovedModule("configparser", "ConfigParser"), -- MovedModule("copyreg", "copy_reg"), -- MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), -- MovedModule("http_cookies", "Cookie", "http.cookies"), -- MovedModule("html_entities", "htmlentitydefs", "html.entities"), -- MovedModule("html_parser", "HTMLParser", "html.parser"), -- MovedModule("http_client", "httplib", "http.client"), -- MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), -- MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), -- MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), -- MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), -- MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), -- MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), -- MovedModule("cPickle", "cPickle", "pickle"), -- MovedModule("queue", "Queue"), -- MovedModule("reprlib", "repr"), -- MovedModule("socketserver", "SocketServer"), -- MovedModule("tkinter", "Tkinter"), -- MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), -- MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), -- MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"), -- MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"), -- MovedModule("tkinter_tix", "Tix", "tkinter.tix"), -- MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), -- MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), -- MovedModule("tkinter_colorchooser", "tkColorChooser", -- "tkinter.colorchooser"), -- MovedModule("tkinter_commondialog", "tkCommonDialog", -- "tkinter.commondialog"), -- MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), -- MovedModule("tkinter_font", "tkFont", "tkinter.font"), -- MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), -- MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", -- "tkinter.simpledialog"), -- MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), -- MovedModule("winreg", "_winreg"), --] --for attr in _moved_attributes: -- setattr(_MovedItems, attr.name, attr) --del attr -- --moves = sys.modules[__name__ + ".moves"] = _MovedItems("moves") -- -- --def add_move(move): -- """Add an item to six.moves.""" -- setattr(_MovedItems, move.name, move) -- -- --def remove_move(name): -- """Remove item from six.moves.""" -- try: -- delattr(_MovedItems, name) -- except AttributeError: -- try: -- del moves.__dict__[name] -- except KeyError: -- raise AttributeError("no such move, %r" % (name,)) -- -- --if PY3: -- _meth_func = "__func__" -- _meth_self = "__self__" -- -- _func_code = "__code__" -- _func_defaults = "__defaults__" -- -- _iterkeys = "keys" -- _itervalues = "values" -- _iteritems = "items" --else: -- _meth_func = "im_func" -- _meth_self = "im_self" -- -- _func_code = "func_code" -- _func_defaults = "func_defaults" -- -- _iterkeys = "iterkeys" -- _itervalues = "itervalues" -- _iteritems = "iteritems" -- -- --try: -- advance_iterator = next --except NameError: -- def advance_iterator(it): -- return it.next() --next = advance_iterator -- -- --if PY3: -- def get_unbound_function(unbound): -- return unbound -- -- Iterator = object -- -- def callable(obj): -- return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) --else: -- def get_unbound_function(unbound): -- return unbound.im_func -- -- class Iterator(object): -- -- def next(self): -- return type(self).__next__(self) -- -- callable = callable --_add_doc(get_unbound_function, -- """Get the function out of a possibly unbound function""") -- -- --get_method_function = operator.attrgetter(_meth_func) --get_method_self = operator.attrgetter(_meth_self) --get_function_code = operator.attrgetter(_func_code) --get_function_defaults = operator.attrgetter(_func_defaults) -- -- --def iterkeys(d): -- """Return an iterator over the keys of a dictionary.""" -- return iter(getattr(d, _iterkeys)()) -- --def itervalues(d): -- """Return an iterator over the values of a dictionary.""" -- return iter(getattr(d, _itervalues)()) -- --def iteritems(d): -- """Return an iterator over the (key, value) pairs of a dictionary.""" -- return iter(getattr(d, _iteritems)()) -- -- --if PY3: -- def b(s): -- return s.encode("latin-1") -- def u(s): -- return s -- def compat_repr(object_repr): -- return object_repr -- -- if sys.version_info[1] <= 1: -- def int2byte(i): -- return bytes((i,)) -- else: -- # This is about 2x faster than the implementation above on 3.2+ -- int2byte = operator.methodcaller("to_bytes", 1, "big") -- import io -- StringIO = io.StringIO -- BytesIO = io.BytesIO --else: -- def b(s): -- return s -- def u(s): -- return unicode(s, "unicode_escape") -- def compat_repr(object_repr): -- # compat_repr is designed to return all reprs with leading 'u's -- # inserted to make all strings look like unicode strings. -- # This makes testing between py2 and py3 much easier. -- result = '' -- in_quote = False -- curr_quote = None -- for char in object_repr: -- if char in ['"', "'"] and ( -- not curr_quote or char == curr_quote): -- if in_quote: -- # Closing quote -- curr_quote = None -- in_quote = False -- else: -- # Opening quote -- curr_quote = char -- result += 'u' -- in_quote = True -- result += char -- return result -- -- int2byte = chr -- import StringIO -- StringIO = BytesIO = StringIO.StringIO --_add_doc(b, """Byte literal""") --_add_doc(u, """Text literal""") -- -- --if PY3: -- import builtins -- exec_ = getattr(builtins, "exec") -- -- -- def reraise(tp, value, tb=None): -- if value.__traceback__ is not tb: -- raise value.with_traceback(tb) -- raise value -- -- -- print_ = getattr(builtins, "print") -- del builtins -- --else: -- def exec_(code, globs=None, locs=None): -- """Execute code in a namespace.""" -- if globs is None: -- frame = sys._getframe(1) -- globs = frame.f_globals -- if locs is None: -- locs = frame.f_locals -- del frame -- elif locs is None: -- locs = globs -- exec("""exec code in globs, locs""") -- -- -- exec_("""def reraise(tp, value, tb=None): -- raise tp, value, tb --""") -- -- -- def print_(*args, **kwargs): -- """The new-style print function.""" -- fp = kwargs.pop("file", sys.stdout) -- if fp is None: -- return -- def write(data): -- if not isinstance(data, basestring): -- data = str(data) -- fp.write(data) -- want_unicode = False -- sep = kwargs.pop("sep", None) -- if sep is not None: -- if isinstance(sep, unicode): -- want_unicode = True -- elif not isinstance(sep, str): -- raise TypeError("sep must be None or a string") -- end = kwargs.pop("end", None) -- if end is not None: -- if isinstance(end, unicode): -- want_unicode = True -- elif not isinstance(end, str): -- raise TypeError("end must be None or a string") -- if kwargs: -- raise TypeError("invalid keyword arguments to print()") -- if not want_unicode: -- for arg in args: -- if isinstance(arg, unicode): -- want_unicode = True -- break -- if want_unicode: -- newline = unicode("\n") -- space = unicode(" ") -- else: -- newline = "\n" -- space = " " -- if sep is None: -- sep = space -- if end is None: -- end = newline -- for i, arg in enumerate(args): -- if i: -- write(sep) -- write(arg) -- write(end) -- --_add_doc(reraise, """Reraise an exception.""") -- -- --def with_metaclass(meta, base=object): -- """Create a base class with a metaclass.""" -- return meta("NewBase", (base,), {}) diff -Nru python-sure-1.2.5/debian/patches/series python-sure-1.2.2/debian/patches/series --- python-sure-1.2.5/debian/patches/series 2014-05-03 03:37:41.000000000 +0000 +++ python-sure-1.2.2/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -adds-support-for-python-3.2.patch -removes-embedded-copy-of-six.patch -fix-broken-setup.py.patch diff -Nru python-sure-1.2.5/debian/pydist-overrides python-sure-1.2.2/debian/pydist-overrides --- python-sure-1.2.5/debian/pydist-overrides 2014-06-17 15:29:29.000000000 +0000 +++ python-sure-1.2.2/debian/pydist-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -rednose diff -Nru python-sure-1.2.5/debian/rules python-sure-1.2.2/debian/rules --- python-sure-1.2.5/debian/rules 2014-05-03 03:37:41.000000000 +0000 +++ python-sure-1.2.2/debian/rules 2013-12-04 08:53:08.000000000 +0000 @@ -1,26 +1,12 @@ #!/usr/bin/make -f -PYTHONS:=$(shell pyversions -vr) -PYTHON3S:=$(shell py3versions -vr) - UPSTREAM_GIT = git://github.com/gabrielfalcao/sure.git -include /usr/share/openstack-pkg-tools/pkgos.make %: - dh $@ --buildsystem=python_distutils --with python2,python3 - -override_dh_auto_install: - set -e && for pyvers in $(PYTHONS); do \ - python$$pyvers setup.py install --install-layout=deb \ - --root $(CURDIR)/debian/python-sure; \ - done - set -e && for pyvers in $(PYTHON3S); do \ - python$$pyvers setup.py install --install-layout=deb \ - --root $(CURDIR)/debian/python3-sure; \ - done + dh $@ --buildsystem=python_distutils --with python2 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) override_dh_auto_test: nosetests - nosetests3 endif diff -Nru python-sure-1.2.5/development.txt python-sure-1.2.2/development.txt --- python-sure-1.2.5/development.txt 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/development.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ --r requirements.txt -steadymark==0.5.3 -markment==0.2.21 -curdling==0.4.0 diff -Nru python-sure-1.2.5/.gitignore python-sure-1.2.2/.gitignore --- python-sure-1.2.5/.gitignore 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/.gitignore 2013-03-27 22:08:43.000000000 +0000 @@ -5,6 +5,3 @@ dist/ sure.egg-info/ .tox -*.sublime-project -*.sublime-workspace -sure-*.tar.gz diff -Nru python-sure-1.2.5/Makefile python-sure-1.2.2/Makefile --- python-sure-1.2.5/Makefile 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/Makefile 2013-03-27 22:08:43.000000000 +0000 @@ -2,17 +2,16 @@ filename=sure-`python -c 'import sure;print sure.version'`.tar.gz -export PYTHONPATH := ${PWD}:${PYTHONPATH} -export SURE_NO_COLORS := true +export PYTHONPATH:= ${PWD} +export SURE_NO_COLORS:= true install_deps: - @curd install -r development.txt + @pip install -r requirements.pip test: - @nosetests -s --verbosity=2 tests --rednose + @nosetests -s --verbosity=2 tests @steadymark OLD_API.md @steadymark README.md - @pandoc -o readme.rst README.md clean: @printf "Cleaning up files that are already in .gitignore... " @@ -26,18 +25,3 @@ publish: @python setup.py sdist register upload - -docstests: clean - @steadymark README.md - - -docs: docstests - @markment -t rtd -o . --sitemap-for="http://falcao.it/sure" spec - @git co master && \ - (git br -D gh-pages || printf "") && \ - git checkout --orphan gh-pages && \ - markment -t rtd -o . --sitemap-for="http://falcao.it/sure" spec && \ - git add . && \ - git commit -am 'documentation' && \ - git push --force origin gh-pages && \ - git checkout master diff -Nru python-sure-1.2.5/MANIFEST.in python-sure-1.2.2/MANIFEST.in --- python-sure-1.2.5/MANIFEST.in 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/MANIFEST.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -include requirements.txt -include README.md -include README.rst diff -Nru python-sure-1.2.5/README.md python-sure-1.2.2/README.md --- python-sure-1.2.5/README.md 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/README.md 2013-03-27 22:08:43.000000000 +0000 @@ -1,31 +1,25 @@ -# sure `1.2.5` - -A testing library for python with powerful and flexible assertions. Sure is heavily inspired by [should.js](https://github.com/visionmedia/should.js/) +## sure `1.2.2` - utility belt for automated testing in python (inspired by [should.js](https://github.com/visionmedia/should.js/) ) [![Build Status](https://travis-ci.org/gabrielfalcao/sure.png?branch=master)](https://travis-ci.org/gabrielfalcao/sure) -# Installing - - user@machine:~$ [sudo] pip install sure - +```python +from sure import version -# Documentation +version.should.be.equal('1.2.2') +``` -Available in the [website](http://falcao.it/sure) or under the `spec` directory. +# Installing -You can also build the documentation locally using markment: + user@machine:~$ [sudo] pip install sure -```bash -pip install markment -markment --server --theme=rtd ./spec/ -``` +# Fluent assertions +> available only on cpython (no support for Jython, IronPython, PyPy, etc) -## Here is a tease +Mind-blowing easy and fluent assertions. -### Equality -#### (number).should.equal(number) +#### `(number).should.equal(number)` ```python import sure @@ -37,7 +31,7 @@ (3).shouldnt.be.equal(5) ``` -#### {'a': 'collection'}.should.equal({'a': 'collection'}) does deep comparison +#### `{'a': 'collection'}.should.equal({'a': 'collection'})` does deep comparison ```python {'foo': 'bar'}.should.equal({'foo': 'bar'}) @@ -46,8 +40,581 @@ ``` -#### "A string".lower().should.equal("a string") also works +#### `"A string".lower().should.equal("a string")` also works ```python "Awesome ASSERTIONS".lower().split().should.equal(['awesome', 'assertions']) ``` + +#### `should.look_like` and `should_not.look_like` + +```python + +""" + +THIS IS MY loose string +""".should.look_like('this is my loose string') + +"""this one is different""".should_not.look_like('this is my loose string') +``` + +#### `should.contain` and `should_not.contain` + +`expect(collection).to.contain(item)` is a shorthand to `expect(item).to.be.within(collection)` + +```python +"My bucket of text".should.contain('bucket') + +"goosfraba".should_not.contain('anger') + +[1,2,3].should.contain(2) +``` + +#### `should.match` and `should_not.match` matches regular expression + +You can also use the modifiers: + +* [`re.DEBUG`](http://docs.python.org/2/library/re.html#re.DEBUG) +* [`re.I` and `re.IGNORECASE`](http://docs.python.org/2/library/re.html#re.IGNORECASE) +* [`re.M` and `re.MULTILINE`](http://docs.python.org/2/library/re.html#re.MULTILINE) +* [`re.S` and `re.DOTALL`](http://docs.python.org/2/library/re.html#re.DOTALL) +* [`re.U` and `re.UNICODE`](http://docs.python.org/2/library/re.html#re.UNICODE) +* [`re.X` and `re.VERBOSE`](http://docs.python.org/2/library/re.html#re.VERBOSE) + +```python +import re + +"SOME STRING".should.match(r'some \w+', re.I) + +"FOO BAR CHUCK NORRIS".should_not.match(r'some \w+', re.M) +``` + + +#### `{iterable}.should.be.empty` applies to any iterable of length 0 + +```python + +[].should.be.empty; +{}.should.be.empty; +set().should.be.empty; +"".should.be.empty; +().should.be.empty +range(0).should.be.empty; + +# negate with: + +[1, 2, 3].shouldnt.be.empty; +"Lincoln de Sousa".shouldnt.be.empty; +"Lincoln de Sousa".should_not.be.empty; + +``` + + +#### `{number}.should.be.within(0, 10)` asserts inclusive numeric range: + +```python +(1).should.be.within(0, 2) +(5).should.be.within(10) + +# negate with: + +(1).shouldnt.be.within(5, 6) +``` + +#### `{member}.should.be.within({iterable})` asserts that a member is part of the iterable: + +```python +"g".should.be.within("gabriel") +'name'.should.be.within({'name': 'Gabriel'}) +'Lincoln'.should.be.within(['Lincoln', 'Gabriel']) + +# negate with: + +'Bug'.shouldnt.be.within(['Sure 1.0']) +'Bug'.should_not.be.within(['Sure 1.0']) + +``` + +#### `should.be.none` and `should_not.be.none` + +Assert whether an object is or not `None`: + +```python + +value = None +value.should.be.none +None.should.be.none + +"".should_not.be.none +(not None).should_not.be.none + +``` + +#### `should.be.ok` and `shouldnt.be.ok` + +Assert truthfulness: + +```python +from sure import this + +True.should.be.ok +'truthy string'.should.be.ok +{'truthy': 'dictionary'}.should.be.ok +``` + +And negate truthfulness: + +```python + +from sure import this + +False.shouldnt.be.ok +''.should_not.be.ok +{}.shouldnot.be.ok +``` + +#### Assert existence of properties and its values + +```python + +class Basket(object): + fruits = ["apple", "banana"] + + +basket1 = Basket() + +basket1.should.have.property("fruits") +``` + +##### .have.property().being allows chaining up + +If the programmer calls `have.property()` it returns an assertion +builder of the property if it exists, so that you can chain up +assertions for the property value itself. + +```python + +class Basket(object): + fruits = ["apple", "banana"] + +basket2 = Basket() +basket2.should.have.property("fruits").being.equal(["apple", "banana"]) +basket2.should.have.property("fruits").with_value.equal(["apple", "banana"]) +basket2.should.have.property("fruits").with_value.being.equal(["apple", "banana"]) +``` + + +#### Assert existence of keys and its values + +```python +basket3 = dict(fruits=["apple", "banana"]) +basket3.should.have.key("fruits") +``` + +##### .have.key().being allows chaining up + +If the programmer calls `have.key()` it returns an assertion +builder of the key if it exists, so that you can chain up +assertions for the dictionary key value itself. + + +```python + +person = dict(name=None) + +person.should.have.key("name").being.none +person.should.have.key("name").being.equal(None) +``` + +#### Assert the length of objects with `{iterable}.should.have.length_of(N)` + +```python + +[3, 4].should.have.length_of(2) + +"Python".should.have.length_of(6) + +{'john': 'person'}.should_not.have.length_of(2) +``` + +#### Assert the magnitude of objects with `{X}.should.be.greater_than(Y)` and `{Y}.should.be.lower_than(X)` as well as `{X}.should.be.greater_than_or_equal_to(Y)` and `{Y}.should.be.lower_than_or_equal_to(X)` + +```python +(5).should.be.greater_than(4) +(5).should_not.be.greater_than(10) +(1).should.be.lower_than(2) +(1).should_not.be.lower_than(0) + +(5).should.be.greater_than_or_equal_to(4) +(5).should_not.be.greater_than_or_equal_to(10) +(1).should.be.lower_than_or_equal_to(2) +(1).should_not.be.lower_than_or_equal_to(0) +``` + +#### `callable.when.called_with(arg1, kwarg1=2).should.throw(Exception)` + +You can use this feature to assert that a callable raises an +exception: + +```python +import sure +from sure.six import PY3 + +if PY3: + range.when.called_with(10, step=20).should.throw(TypeError, "range() does not take keyword arguments") + range.when.called_with("chuck norris").should.throw(TypeError, "'str' object cannot be interpreted as an integer") +else: + range.when.called_with(10, step="20").should.throw(TypeError, "range() takes no keyword arguments") + range.when.called_with(b"chuck norris").should.throw("range() integer end argument expected, got str.") +range.when.called_with("chuck norris").should.throw(TypeError) +range.when.called_with(10).should_not.throw(TypeError) +``` + +#### `function.when.called_with(arg1, kwarg1=2).should.return_value(value)` + +This is a shorthand for testing that a callable returns the expected +result + +```python +import sure + +list.when.called_with([0, 1]).should.return_value([0, 1]) +``` + +this is the same as + +``` +value = range(2) +value.should.equal([0, 1]) +``` + +there are no differences between those 2 possibilities, use at will + +#### `instance.should.be.a('typename')` and `instance.should.be.an('typename')` + +this takes a type name and checks if the class matches that name + +```python +import sure + +{}.should.be.a('dict') +(5).should.be.an('int') + +# also works with paths + +range(10).should.be.a('collections.Iterable') +``` + +#### `instance.should.be.a(type)` and `instance.should.be.an(type)` + +this takes the class (type) itself and checks if the object is an instance of it + +```python +import sure +from sure.six import PY3 + +if PY3: + u"".should.be.an(str) +else: + u"".should.be.an(unicode) +[].should.be.a(list) +``` + +#### `instance.should.be.above(num)` and `instance.should.be.below(num)` + +assert the instance value above and below `num` + +```python +import sure + +(10).should.be.below(11) +(10).should.be.above(9) +(10).should_not.be.above(11) +(10).should_not.be.below(9) +``` + + +# Static assertions with `it`, `this`, `those` and `these` + +Whether you don't like the `object.should` syntax or you are simply +not running CPython, sure still allows you to use any of the +assertions above, all you need to do is wrap the object that is being +compared in one of the following options: `it`, `this`, `those` and +`these`. + +## Too long, don't read + +### All those possibilities below work just as the same + +```python +from sure import it, this, those, these + +(10).should.be.equal(5 + 5) + +this(10).should.be.equal(5 + 5) + +it(10).should.be.equal(5 + 5) + +these(10).should.be.equal(5 + 5) + +those(10).should.be.equal(5 + 5) +``` + +### Also if you prefer using the `assert` keyword in your tests just go ahead an do it! + +```python +from sure import it, this, those, these, expect + +assert (10).should.be.equal(5 + 5) + +assert this(10).should.be.equal(5 + 5) + +assert it(10).should.be.equal(5 + 5) + +assert these(10).should.be.equal(5 + 5) + +assert those(10).should.be.equal(5 + 5) + +expect(10).to.be.equal(5 + 5) +expect(10).to.not_be.equal(8) +``` + +#### `(lambda: None).should.be.callable` + +Test if something is or not callable + +```python +import sure + +range.should.be.callable +(lambda: None).should.be.callable; +(123).should_not.be.callable +``` + +### A note about the `assert` keyword + +_you can use or not the_ `assert` _keyword, sure internally already +raises an appropriate_ `AssertionError` _with an assertion message so +that you don't have to specify your own, but you can still use_ +`assert` _if you find it more semantic_ + +Example: + +```python +import sure + +"Name".lower().should.equal('name') + +# or you can also use + +assert "Name".lower().should.equal('name') + +# or still + +from sure import this + +assert this("Name".lower()).should.equal('name') + +# also without the `assert` + +this("Name".lower()).should.equal('name') + +``` + +Any of the examples above will raise their own `AssertionError` with a +meaningful error message. + +# Synonyms + +Sure provides you with a lot of synonyms so that you can pick the ones +that makes more sense for your tests. + +Note that the examples below are merely illustrative, they work not +only with numbers but with any of the assertions you read early in +this documentation. + +## Positive synonyms + +```python + +(2 + 2).should.be.equal(4) +(2 + 2).must.be.equal(4) +(2 + 2).does.equals(4) +(2 + 2).do.equals(4) +``` + +## Negative synonyms + +```python +from sure import expect + +(2).should_not.be.equal(3) +(2).shouldnt.be.equal(3) +(2).doesnt.equals(3) +(2).does_not.equals(3) +(2).doesnot.equals(3) +(2).dont.equal(3) +(2).do_not.equal(3) + +expect(3).to.not_be.equal(1) +``` + +## Chain-up synonyms + +Any of those synonyms work as an alias to the assertion builder: + +* `be` +* `being` +* `to` +* `when` +* `have` +* `with_value` + +```python +from sure import expect + +{"foo": 1}.must.with_value.being.equal({"foo": 1}) +{"foo": 1}.does.have.key("foo").being.with_value.equal(1) +``` + +## Equality synonyms + +```python + +(2).should.equal(2) +(2).should.equals(2) +(2).should.eql(2) +``` + +## Positive boolean synonyms + +```python + +(not None).should.be.ok +(not None).should.be.truthy +(not None).should.be.true +``` + +## Negative boolean synonyms + +```python +False.should.be.falsy +False.should.be.false +False.should_not.be.true +False.should_not.be.ok +None.should_not.be.true +None.should_not.be.ok +``` + +# Can I disable those the new syntax by default ? + +Sure! :+1: + +Just export the `SURE_DISABLE_NEW_SYNTAX` environment variable before +running your tests. + +```console +export SURE_DISABLE_NEW_SYNTAX=True +``` +# Python compatibility + +## Those are the python versions that support the assertions above [`CPython`](http://en.wikipedia.org/wiki/CPython) + + +``` + +Python ~= 2.6 (CPython) +Python ~= 2.7 (CPython) + +``` + +## Not supported: + +``` + +Jython + +PyPy + +IronPython + +UnladenSwallow + +StacklessPython + +... +``` + +## Why CPython-only ? + +Sure has a slick algorithm that makes use of the +[ctypes](http://docs.python.org/library/ctypes), and although it is +also available in other implementations such as +[Jython](http://www.jython.org/) does have the `ctypes` module, only +the CPython provides +[`ctypes.pythonapi`](http://docs.python.org/library/ctypes#loading-shared-libraries), +required by sure. + +### Holy guacamole, how did you implement that feature ? + +Differently of [ruby](http://www.ruby-lang.org) python doesn't have +[open classes](http://blog.aizatto.com/2007/06/01/ruby-and-open-classes/), +but [Lincoln de Sousa](https://github.com/clarete/) came out with a +super [sick code](https://github.com/gabrielfalcao/sure/blob/master/sure/magic.py) that uses the ctypes module to create a pointer to the +`__dict__` of builtin types. + +Yes, it is dangerous, non-pythonic and should not be used in production code. + +Although `sure` is here to be used __ONLY__ in test code, therefore it +should be running in __ONLY__ possible environments: your local +machine or your continuous-integration server. + +# About sure 1.0 + +The assertion library is 100% inspired be the awesomeness of +[should.js](https://github.com/visionmedia/should.js) which is simple, +declarative and fluent. + +Sure strives to provide everything a python developer needs in an assertion: + +* Assertion messages are easy to understand + +* When comparing iterables the comparation is recursive and shows + exactly where is the error + +* Fluency: the builtin types are changed in order to provide awesome + simple assertions + +# Old API + +Sure still provides to all the assertions from v0.10 up, you can [find the old documentation here](https://github.com/gabrielfalcao/sure/blob/master/OLD_API.md) + +# Release Notes: + +## on version 1.1.0 + +* `from sure import that` is not deprecated, use `from sure.deprecated import that` instead, but aim on replacing usage of `that()` to `expect()` + +## Authors + +[Gabriel Falcão](http://github.com/gabrielfalcao) and [Lincoln Clarete](http://github.com/clarete) + + +# License (GPLv3) + + + Copyright (C) <2012> Gabriel Falcão + Copyright (C) <2012> Lincoln Clarete + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . diff -Nru python-sure-1.2.5/README.rst python-sure-1.2.2/README.rst --- python-sure-1.2.5/README.rst 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/README.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -sure ``1.2.5`` -============== - -A testing library for python with powerful and flexible assertions. Sure -is heavily inspired by -`should.js `__ - -|Build Status| - -Installing -========== - -:: - - user@machine:~$ [sudo] pip install sure - -Documentation -============= - -Available in the `website `__ or under the -``spec`` directory. - -You can also build the documentation locally using markment: - -.. code:: bash - - pip install markment - markment --server --theme=rtd ./spec/ - -Here is a tease ---------------- - -Equality -~~~~~~~~ - -(number).should.equal(number) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code:: python - - import sure - - (4).should.be.equal(2 + 2) - (7.5).should.eql(3.5 + 4) - (2).should.equal(8 / 4) - - (3).shouldnt.be.equal(5) - -{'a': 'collection'}.should.equal({'a': 'collection'}) does deep comparison -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code:: python - - {'foo': 'bar'}.should.equal({'foo': 'bar'}) - {'foo': 'bar'}.should.eql({'foo': 'bar'}) - {'foo': 'bar'}.must.be.equal({'foo': 'bar'}) - -"A string".lower().should.equal("a string") also works -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code:: python - - "Awesome ASSERTIONS".lower().split().should.equal(['awesome', 'assertions']) - -.. |Build Status| image:: https://travis-ci.org/gabrielfalcao/sure.png?branch=master - :target: https://travis-ci.org/gabrielfalcao/sure diff -Nru python-sure-1.2.5/requirements.pip python-sure-1.2.2/requirements.pip --- python-sure-1.2.5/requirements.pip 1970-01-01 00:00:00.000000000 +0000 +++ python-sure-1.2.2/requirements.pip 2013-03-27 22:08:43.000000000 +0000 @@ -0,0 +1,3 @@ +distribute>=0.6.24 +steadymark>=0.4.5 +nose>=1.1.2 diff -Nru python-sure-1.2.5/requirements.txt python-sure-1.2.2/requirements.txt --- python-sure-1.2.5/requirements.txt 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/requirements.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -nose==1.3.0 -rednose==0.4.1 diff -Nru python-sure-1.2.5/setup.py python-sure-1.2.2/setup.py --- python-sure-1.2.5/setup.py 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/setup.py 2013-03-27 22:08:43.000000000 +0000 @@ -16,77 +16,27 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import ast import os -import re -from setuptools import setup, find_packages +from sure import version +from setuptools import setup -class VersionFinder(ast.NodeVisitor): - - def __init__(self): - self.version = None - - def visit_Assign(self, node): - try: - if node.targets[0].id == 'version': - self.version = node.value.s - except: - pass - - -def read_version(): - """Read version from sure/version.py without loading any files""" - finder = VersionFinder() - finder.visit(ast.parse(local_file('sure', '__init__.py'))) - return finder.version - - -def parse_requirements(path): - """Rudimentary parser for the `requirements.txt` file - - We just want to separate regular packages from links to pass them to the - `install_requires` and `dependency_links` params of the `setup()` - function properly. - """ - try: - requirements = map(str.strip, local_file(path).splitlines()) - except IOError: - raise RuntimeError("Couldn't find the `requirements.txt' file :(") - - links = [] - pkgs = [] - for req in requirements: - if not req: - continue - if 'http:' in req or 'https:' in req: - links.append(req) - name, version = re.findall("\#egg=([^\-]+)-(.+$)", req)[0] - pkgs.append('{0}=={1}'.format(name, version)) - else: - pkgs.append(req) - - return pkgs, links - - -local_file = lambda *f: \ - open(os.path.join(os.path.dirname(__file__), *f)).read() - - -install_requires, dependency_links = \ - parse_requirements('requirements.txt') - - -if __name__ == '__main__': - setup(name='sure', - version=read_version(), - description='utility belt for automated testing in python for python', - author='Gabriel Falcao', - long_description=local_file('README.rst'), - author_email='gabriel@nacaolivre.org', - include_package_data=True, - url='http://github.com/gabrielfalcao/sure', - packages=find_packages(exclude=['*tests*']), - install_requires=install_requires, - dependency_links=dependency_links, - ) +def get_packages(): + # setuptools can't do the job :( + packages = [] + for root, dirnames, filenames in os.walk('sure'): + if '__init__.py' in filenames: + packages.append(".".join(os.path.split(root)).strip(".")) + + return packages + +setup(name='sure', + version=version, + description='utility belt for automated testing in python for python', + author=u'Gabriel Falcao', + author_email='gabriel@nacaolivre.org', + url='http://github.com/gabrielfalcao/sure', + packages=get_packages(), + install_requires=[ + ], +) diff -Nru python-sure-1.2.5/spec/getting-started.md python-sure-1.2.2/spec/getting-started.md --- python-sure-1.2.5/spec/getting-started.md 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/spec/getting-started.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -# Getting Started - -## Installing - -It is available in PyPi, so you can install through pip: - -```bash -pip install sure -``` -## Activating - -Sure is activated upon importing it, unless the environment variable -`SURE_DISABLE_NEW_SYNTAX` is set to any non-falsy value. (You could -just use `true`) - -For test code cleaningness it's recommended to import sure only once in the `__init__.py` of your root test package. - -Here is an example: - -```bash -mymodule.py -tests/ -tests/__init__.py # this is our guy -tests/unit/__init__.py -tests/unit/test_mymodule_unit1.py -tests/functional/__init__.py -tests/functional/test_mymodule_functionality.py -``` - -That is unless, of course, you want to explicitly import the assertion -helpers from sure in every module. - - -# Python version compatibility - -Sure is -[continuously tested against](https://travis-ci.org/gabrielfalcao/sure/) -python versions 2.6, 2.7 and 3.3, but its assertion API is most likely -to work anywhere. The only real big difference of sure in cpython and -even other implementations such as [PyPy](http://pypy.org/) is that -the [monkey-patching](how-it-works.md#monkey-patching) only happens in -CPython. - -You can always get around beautifully with `expect`: - -```python -from sure import expect - -expect("this".replace("is", "at")).to.equal("that") -``` - -where in cpython you could do: - -```python -"this".replace("is", "at").should.equal("that") -``` - -# Disabling the monkey patching - -Just export the `SURE_DISABLE_NEW_SYNTAX` environment variable before -running your tests. - -```console -export SURE_DISABLE_NEW_SYNTAX=true -``` diff -Nru python-sure-1.2.5/spec/how-it-works.md python-sure-1.2.2/spec/how-it-works.md --- python-sure-1.2.5/spec/how-it-works.md 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/spec/how-it-works.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -# How sure works - -The class `sure.AssertionBuilder` creates objects capable of doing -assertions. The AssertionBuilder simply arranges a vast set of -possible assertions that are composed by a `source` object and a -`destination` object. - -Every assertion, even implicitly if implicitly like in `(2 < 3).should.be.true`, is doing a source/destination matching. - - -## Chainability - -Some specific assertion methods are chainable, it can be useful for short assertions like: - -```python -PERSON = { - "name": "John", - "facebook_info": { - "token": "abcd" - } -} - -PERSON.should.have.key("facebook_info").being.a(dict) -``` - -# Monkey-patching - -Lincoln Clarete has written the module [`sure/magic.py`] which I simply added to sure. The most exciting part of the story is that Lincoln exposed the code with a super clean API, it's called [forbidden fruit](http://clarete.github.io/forbiddenfruit/) - -## Why CPython-only ? - -Sure uses the [ctypes](http://docs.python.org/library/ctypes) module -to break in python protections against monkey patching. - -Although ctypes might also be available in other implementations such -as [Jython](http://www.jython.org/), only the CPython provide -[`ctypes.pythonapi`](http://docs.python.org/library/ctypes#loading-shared-libraries) -the features required by sure. diff -Nru python-sure-1.2.5/spec/intro.md python-sure-1.2.2/spec/intro.md --- python-sure-1.2.5/spec/intro.md 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/spec/intro.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -# Introduction - -Sure is a python library for python that leverages a DSL for writing -assertions. - -In CPython it monkey-patches the `object` type, adding some methods -and properties purely for test purposes. - -Any python code writen after `import sure` gains testing superpowers, -so you can write assertions like this: - -```python -import sure - - -def some_bratty_function(parameter): - raise ValueError("Me no likey {0}".format(parameter)) - - -some_bratty_function.when.called_with("Scooby").should.throw(ValueError, "Me no likey Scooby") -``` - -Let's [get it started](getting-started.md) diff -Nru python-sure-1.2.5/spec/.markment.yml python-sure-1.2.2/spec/.markment.yml --- python-sure-1.2.5/spec/.markment.yml 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/spec/.markment.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -project: - name: "Sure" - version: 0.1.0 - description: testing library for python - - github_maintainer: gabrielfalcao - github_maintainer_name: Gabriel Falcão - github_maintainer_url: http://github.com/gabrielfalcao - github_maintainer_gravatar: https://secure.gravatar.com/avatar/3fa0df5c54f5ac0f8652d992d7d24039?s=64 - - github_url: http://github.com/gabrielfalcao/sure - github_fork_url: https://github.com/gabrielfalcao/sure/archive/master.tar.gz - tarball_download_url: https://github.com/gabrielfalcao/sure/archive/master.tar.gz - zipball_download_url: https://github.com/gabrielfalcao/sure/archive/master.zip - - logo_path: images/logo.png - logo_inline_css: "display: block" - full_index: true - - -documentation: - index: intro.md - -toc: - - intro.md - - getting-started.md - - reference.md - - how-it-works.md \ No newline at end of file diff -Nru python-sure-1.2.5/spec/reference.md python-sure-1.2.2/spec/reference.md --- python-sure-1.2.5/spec/reference.md 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/spec/reference.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,523 +0,0 @@ -# Equality - -## (number).should.equal(number) - -```python -import sure - -(4).should.be.equal(2 + 2) -(7.5).should.eql(3.5 + 4) -(2).should.equal(8 / 4) - -(3).shouldnt.be.equal(5) -``` - -## {'a': 'collection'}.should.equal({'a': 'collection'}) does deep comparison - -```python -{'foo': 'bar'}.should.equal({'foo': 'bar'}) -{'foo': 'bar'}.should.eql({'foo': 'bar'}) -{'foo': 'bar'}.must.be.equal({'foo': 'bar'}) - -``` - -## "A string".lower().should.equal("a string") also works - -```python -"Awesome ASSERTIONS".lower().split().should.equal(['awesome', 'assertions']) -``` - -# Similarity - -## should.look_like and should_not.look_like - -```python - -""" - -THIS IS MY loose string -""".should.look_like('this is my loose string') - -"""this one is different""".should_not.look_like('this is my loose string') -``` - -# Iterables - -## should.contain and should_not.contain - -`expect(collection).to.contain(item)` is a shorthand to `expect(item).to.be.within(collection)` - -```python -"My bucket of text".should.contain('bucket') - -"goosfraba".should_not.contain('anger') - -[1.2.5].should.contain(2) -``` - -## should.match and should_not.match matches regular expression - -You can also use the modifiers: - -* [`re.DEBUG`](http://docs.python.org/2/library/re.html#re.DEBUG) -* [`re.I` and `re.IGNORECASE`](http://docs.python.org/2/library/re.html#re.IGNORECASE) -* [`re.M` and `re.MULTILINE`](http://docs.python.org/2/library/re.html#re.MULTILINE) -* [`re.S` and `re.DOTALL`](http://docs.python.org/2/library/re.html#re.DOTALL) -* [`re.U` and `re.UNICODE`](http://docs.python.org/2/library/re.html#re.UNICODE) -* [`re.X` and `re.VERBOSE`](http://docs.python.org/2/library/re.html#re.VERBOSE) - -```python -import re - -"SOME STRING".should.match(r'some \w+', re.I) - -"FOO BAR CHUCK NORRIS".should_not.match(r'some \w+', re.M) -``` - - -## {iterable}.should.be.empty applies to any iterable of length 0 - -```python - -[].should.be.empty; -{}.should.be.empty; -set().should.be.empty; -"".should.be.empty; -().should.be.empty -range(0).should.be.empty; - -# negate with: - -[1, 2, 3].shouldnt.be.empty; -"Lincoln de Sousa".shouldnt.be.empty; -"Lincoln de Sousa".should_not.be.empty; - -``` - - -## {number}.should.be.within(0, 10) asserts inclusive numeric range: - -```python -(1).should.be.within(0, 2) -(5).should.be.within(10) - -# negate with: - -(1).shouldnt.be.within(5, 6) -``` - -## {member}.should.be.within({iterable}) asserts that a member is part of the iterable: - -```python -"g".should.be.within("gabriel") -'name'.should.be.within({'name': 'Gabriel'}) -'Lincoln'.should.be.within(['Lincoln', 'Gabriel']) - -# negate with: - -'Bug'.shouldnt.be.within(['Sure 1.0']) -'Bug'.should_not.be.within(['Sure 1.0']) - -``` - -## should.be.none and should_not.be.none - -Assert whether an object is or not `None`: - -```python - -value = None -value.should.be.none -None.should.be.none - -"".should_not.be.none -(not None).should_not.be.none - -``` - -## should.be.ok and shouldnt.be.ok - -Assert truthfulness: - -```python -from sure import this - -True.should.be.ok -'truthy string'.should.be.ok -{'truthy': 'dictionary'}.should.be.ok -``` - -And negate truthfulness: - -```python - -from sure import this - -False.shouldnt.be.ok -''.should_not.be.ok -{}.shouldnot.be.ok -``` - -## Assert existence of properties and their values - -```python - -class Basket(object): - fruits = ["apple", "banana"] - - -basket1 = Basket() - -basket1.should.have.property("fruits") -``` - -### .have.property().being allows chaining up - -If the programmer calls `have.property()` it returns an assertion -builder of the property if it exists, so that you can chain up -assertions for the property value itself. - -```python - -class Basket(object): - fruits = ["apple", "banana"] - -basket2 = Basket() -basket2.should.have.property("fruits").being.equal(["apple", "banana"]) -basket2.should.have.property("fruits").with_value.equal(["apple", "banana"]) -basket2.should.have.property("fruits").with_value.being.equal(["apple", "banana"]) -``` - - -## Assert existence of keys and its values - -```python -basket3 = dict(fruits=["apple", "banana"]) -basket3.should.have.key("fruits") -``` - -### .have.key().being allows chaining up - -If the programmer calls `have.key()` it returns an assertion -builder of the key if it exists, so that you can chain up -assertions for the dictionary key value itself. - - -```python - -person = dict(name=None) - -person.should.have.key("name").being.none -person.should.have.key("name").being.equal(None) -``` - -## Assert the length of objects with {iterable}.should.have.length_of(N) - -```python - -[3, 4].should.have.length_of(2) - -"Python".should.have.length_of(6) - -{'john': 'person'}.should_not.have.length_of(2) -``` - -## Assert the magnitude of objects with {X}.should.be.greater_than(Y) and {Y}.should.be.lower_than(X) as well as {X}.should.be.greater_than_or_equal_to(Y) and {Y}.should.be.lower_than_or_equal_to(X) - -```python -(5).should.be.greater_than(4) -(5).should_not.be.greater_than(10) -(1).should.be.lower_than(2) -(1).should_not.be.lower_than(0) - -(5).should.be.greater_than_or_equal_to(4) -(5).should_not.be.greater_than_or_equal_to(10) -(1).should.be.lower_than_or_equal_to(2) -(1).should_not.be.lower_than_or_equal_to(0) -``` - -## callable.when.called_with(arg1, kwarg1=2).should.throw(Exception) - -You can use this feature to assert that a callable raises an -exception: - -```python -import sure -from sure.six import PY3 - -if PY3: - range.when.called_with(10, step=20).should.throw(TypeError, "range() does not take keyword arguments") - range.when.called_with("chuck norris").should.throw(TypeError, "'str' object cannot be interpreted as an integer") -else: - range.when.called_with(10, step="20").should.throw(TypeError, "range() takes no keyword arguments") - range.when.called_with(b"chuck norris").should.throw("range() integer end argument expected, got str.") -range.when.called_with("chuck norris").should.throw(TypeError) -range.when.called_with(10).should_not.throw(TypeError) -``` - -## function.when.called_with(arg1, kwarg1=2).should.return_value(value) - -This is a shorthand for testing that a callable returns the expected -result - -```python -import sure - -list.when.called_with([0, 1]).should.return_value([0, 1]) -``` - -this is the same as - -``` -value = range(2) -value.should.equal([0, 1]) -``` - -there are no differences between those 2 possibilities, use at will - -## instance.should.be.a('typename') and instance.should.be.an('typename') - -this takes a type name and checks if the class matches that name - -```python -import sure - -{}.should.be.a('dict') -(5).should.be.an('int') - -# also works with paths to modules - -range(10).should.be.a('collections.Iterable') -``` - -## instance.should.be.a(type) and instance.should.be.an(type) - -this takes the class (type) itself and checks if the object is an instance of it - -```python -import sure -from sure.six import PY3 - -if PY3: - u"".should.be.an(str) -else: - u"".should.be.an(unicode) -[].should.be.a(list) -``` - -## instance.should.be.above(num) and instance.should.be.below(num) - -assert the instance value above and below `num` - -```python -import sure - -(10).should.be.below(11) -(10).should.be.above(9) -(10).should_not.be.above(11) -(10).should_not.be.below(9) -``` - - -# Static assertions with it, this, those and these - -Whether you don't like the `object.should` syntax or you are simply -not running CPython, sure still allows you to use any of the -assertions above, all you need to do is wrap the object that is being -compared in one of the following options: `it`, `this`, `those` and -`these`. - -## Too long, don't read - -### All those possibilities below work just as the same - -```python -from sure import it, this, those, these - -(10).should.be.equal(5 + 5) - -this(10).should.be.equal(5 + 5) - -it(10).should.be.equal(5 + 5) - -these(10).should.be.equal(5 + 5) - -those(10).should.be.equal(5 + 5) -``` - -### Also if you prefer using the assert keyword in your tests just go ahead an do it! - -```python -from sure import it, this, those, these, expect - -assert (10).should.be.equal(5 + 5) - -assert this(10).should.be.equal(5 + 5) - -assert it(10).should.be.equal(5 + 5) - -assert these(10).should.be.equal(5 + 5) - -assert those(10).should.be.equal(5 + 5) - -expect(10).to.be.equal(5 + 5) -expect(10).to.not_be.equal(8) -``` - -## (lambda: None).should.be.callable - -Test if something is or not callable - -```python -import sure - -range.should.be.callable -(lambda: None).should.be.callable; -(123).should_not.be.callable -``` - -### A note about the assert keyword - -_you can use or not the_ `assert` _keyword, sure internally already -raises an appropriate_ `AssertionError` _with an assertion message so -that you don't have to specify your own, but you can still use_ -`assert` _if you find it more semantic_ - -Example: - -```python -import sure - -"Name".lower().should.equal('name') - -# or you can also use - -assert "Name".lower().should.equal('name') - -# or still - -from sure import this - -assert this("Name".lower()).should.equal('name') - -# also without the assert - -this("Name".lower()).should.equal('name') - -``` - -Any of the examples above will raise their own `AssertionError` with a -meaningful error message. - -# Synonyms - -Sure provides you with a lot of synonyms so that you can pick the ones -that makes more sense for your tests. - -Note that the examples below are merely illustrative, they work not -only with numbers but with any of the assertions you read early in -this documentation. - -## Positive synonyms - -```python - -(2 + 2).should.be.equal(4) -(2 + 2).must.be.equal(4) -(2 + 2).does.equals(4) -(2 + 2).do.equals(4) -``` - -## Negative synonyms - -```python -from sure import expect - -(2).should_not.be.equal(3) -(2).shouldnt.be.equal(3) -(2).doesnt.equals(3) -(2).does_not.equals(3) -(2).doesnot.equals(3) -(2).dont.equal(3) -(2).do_not.equal(3) - -expect(3).to.not_be.equal(1) -``` - -## Chain-up synonyms - -Any of those synonyms work as an alias to the assertion builder: - -* `be` -* `being` -* `to` -* `when` -* `have` -* `with_value` - -```python -from sure import expect - -{"foo": 1}.must.with_value.being.equal({"foo": 1}) -{"foo": 1}.does.have.key("foo").being.with_value.equal(1) -``` - -## Equality synonyms - -```python - -(2).should.equal(2) -(2).should.equals(2) -(2).should.eql(2) -``` - -## Positive boolean synonyms - -```python - -(not None).should.be.ok -(not None).should.be.truthy -(not None).should.be.true -``` - -## Negative boolean synonyms - -```python -False.should.be.falsy -False.should.be.false -False.should_not.be.true -False.should_not.be.ok -None.should_not.be.true -None.should_not.be.ok -``` - - -### Holy guacamole, how did you implement that feature ? - -Differently of [ruby](http://www.ruby-lang.org) python doesn't have -[open classes](http://blog.aizatto.com/2007/06/01/ruby-and-open-classes/), -but [Lincoln de Sousa](https://github.com/clarete/) came out with a -super [sick code](https://github.com/gabrielfalcao/sure/blob/master/sure/magic.py) that uses the ctypes module to create a pointer to the -`__dict__` of builtin types. - -Yes, it is dangerous, non-pythonic and should not be used in production code. - -Although `sure` is here to be used __ONLY__ in test code, therefore it -should be running in __ONLY__ possible environments: your local -machine or your continuous-integration server. - -# About sure 1.0 - -The assertion library is 100% inspired be the awesomeness of -[should.js](https://github.com/visionmedia/should.js) which is simple, -declarative and fluent. - -Sure strives to provide everything a python developer needs in an assertion: - -* Assertion messages are easy to understand - -* When comparing iterables the comparation is recursive and shows - exactly where is the error - -* Fluency: the builtin types are changed in order to provide awesome - simple assertions diff -Nru python-sure-1.2.5/sure/__init__.py python-sure-1.2.2/sure/__init__.py --- python-sure-1.2.5/sure/__init__.py 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/sure/__init__.py 2013-03-27 22:08:43.000000000 +0000 @@ -46,7 +46,7 @@ if PY3: basestring = str -version = '1.2.5' +version = '1.2.2' not_here_error = \ @@ -410,21 +410,6 @@ ] -class IdentityAssertion(object): - def __init__(self, assertion_builder): - self._ab = assertion_builder - - def __call__(self, other): - if self._ab.negative: - assert self._ab.obj is not other, "{0} should not be the same object as {1}, but it is".format(self._ab.obj, other) - return True - assert self._ab.obj is other, "{0} should be the same object as {1}, but it is not".format(self._ab.obj, other) - return True - - def __getattr__(self, name): - return getattr(self._ab, name) - - class AssertionBuilder(object): def __init__(self, name=None, negative=False, obj=None): self._name = name @@ -467,20 +452,19 @@ @assertionproperty def be(self): - import os - if os.getenv("DEBUG"): - import ipdb;ipdb.set_trace() - + return self - return IdentityAssertion(self) + @assertionproperty + def being(self): + return self - being = be + @assertionproperty + def not_being(self): + return self.should_not @assertionproperty def not_be(self): - return IdentityAssertion(self.should_not) - - not_being = not_be + return self.should_not @assertionproperty def not_have(self): @@ -540,7 +524,7 @@ assert length > 0, ( u"expected `{0}` to not be empty".format(representation)) else: - assert length == 0, ( + assert length is 0, ( u"expected `{0}` to be empty but it has {1} items".format(representation, length)) return True @@ -622,7 +606,6 @@ eql = equal equals = equal - equal_to = equal @assertionmethod def an(self, klass): @@ -876,10 +859,10 @@ def method(self): builder = AssertionBuilder(name, negative=False) instance = builder(self) - callable_args = getattr(instance, '_callable_args', ()) + callable_args = getattr(self, '_callable_args', None) if callable_args: instance._callable_args = callable_args - callable_kw = getattr(instance, '_callable_kw', {}) + callable_kw = getattr(self, '_callable_kw', None) if callable_kw: instance._callable_kw = callable_kw return instance @@ -891,10 +874,10 @@ def method(self): builder = AssertionBuilder(name, negative=True) instance = builder(self) - callable_args = getattr(instance, '_callable_args', ()) + callable_args = getattr(self, '_callable_args', None) if callable_args: instance._callable_args = callable_args - callable_kw = getattr(instance, '_callable_kw', {}) + callable_kw = getattr(self, '_callable_kw', None) if callable_kw: instance._callable_kw = callable_kw return instance @@ -920,13 +903,13 @@ old_dir = dir -if allows_new_syntax: - @wraps(builtins.dir) - def _new_dir(obj=None): - if obj is None: - frame = inspect.currentframe() - return sorted(frame.f_back.f_locals.keys()) - else: - return sorted(set(old_dir(obj)).difference(POSITIVES + NEGATIVES)) +@wraps(builtins.dir) +def _new_dir(obj=None): + if obj is None: + frame = inspect.currentframe() + return sorted(frame.f_back.f_locals.keys()) + else: + return sorted(set(old_dir(obj)).difference(POSITIVES + NEGATIVES)) + - builtins.dir = _new_dir +builtins.dir = _new_dir diff -Nru python-sure-1.2.5/sure/old.py python-sure-1.2.2/sure/old.py --- python-sure-1.2.5/sure/old.py 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/sure/old.py 2013-03-27 22:08:43.000000000 +0000 @@ -18,7 +18,6 @@ from __future__ import unicode_literals import re -import traceback import inspect from copy import deepcopy from pprint import pformat @@ -115,18 +114,18 @@ try: self._src(*self._callable_args, **self._callable_kw) - except BaseException as e: + except Exception as e: if isinstance(exc, string_types): msg = exc exc = type(e) - + err = text_type(e) - if isinstance(exc, type) and issubclass(exc, BaseException): + if isinstance(exc, type) and issubclass(exc, Exception): if not isinstance(e, exc): raise AssertionError( - '%r should raise %r, but raised %r:\nORIGINAL EXCEPTION:\n\n%s' % ( - self._src, exc, e.__class__, traceback.format_exc(e))) + '%r should raise %r, but raised %r' % ( + self._src, exc, e.__class__)) if isinstance(msg, string_types) and msg not in err: raise AssertionError(''' diff -Nru python-sure-1.2.5/tests/test_assertion_builder.py python-sure-1.2.2/tests/test_assertion_builder.py --- python-sure-1.2.5/tests/test_assertion_builder.py 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/tests/test_assertion_builder.py 2013-03-27 22:08:43.000000000 +0000 @@ -294,33 +294,6 @@ "expected `1` to not be lower than or equal to `2`") -def test_be(): - (u"this(X).should.be(X) when X is a reference to the same object") - - d1 = {} - d2 = d1 - d3 = {} - - assert isinstance(this(d2).should.be(d1), bool) - assert this(d2).should.be(d1) - assert this(d3).should_not.be(d1) - - def wrong_should(): - return this(d3).should.be(d1) - - def wrong_should_not(): - return this(d2).should_not.be(d1) - - wrong_should_not.when.called.should.throw( - AssertionError, - '{} should not be the same object as {}, but it is', - ) - wrong_should.when.called.should.throw( - AssertionError, - '{} should be the same object as {}, but it is not', - ) - - def test_have_property(): (u"this(instance).should.have.property(property_name)") @@ -586,15 +559,3 @@ else: expect(opposite_not).when.called.to.throw( "u'string' should NOT be in u'some string'") - - -def test_catching_exceptions(): - - # Given that I have a function that raises an exceptiont that does *not* - # inherit from the `Exception` class - def blah(): - raise SystemExit(2) - - # When I call it testing which exception it's raising, Then it should be - # successful - expect(blah).when.called_with().should.throw(SystemExit) diff -Nru python-sure-1.2.5/.travis.yml python-sure-1.2.2/.travis.yml --- python-sure-1.2.5/.travis.yml 2014-02-07 17:44:49.000000000 +0000 +++ python-sure-1.2.2/.travis.yml 2013-03-27 22:08:43.000000000 +0000 @@ -6,8 +6,6 @@ # command to install dependencies install: - - pip install curdling - - python setup.py build sdist - - curd install -r requirements.txt + - pip install -r requirements.pip # command to run tests script: nosetests --verbosity 2