3 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/e7240388f09d/ Changeset: e7240388f09d User: flub Date: 2013-04-28 21:56:56 Summary: Minor style cleanup Affected #: 1 file
diff -r c4f58165e0d46166ef7b0b05c3f15ac07387ac10 -r e7240388f09d3a2fc3feacb926c601f0c44544b1 _pytest/assertion/util.py --- a/_pytest/assertion/util.py +++ b/_pytest/assertion/util.py @@ -10,6 +10,7 @@ # DebugInterpreter. _reprcompare = None + def format_explanation(explanation): """This formats an explanation @@ -85,7 +86,7 @@ def assertrepr_compare(config, op, left, right): """Return specialised explanations for some operators/operands""" - width = 80 - 15 - len(op) - 2 # 15 chars indentation, 1 space around op + width = 80 - 15 - len(op) - 2 # 15 chars indentation, 1 space around op left_repr = py.io.saferepr(left, maxsize=int(width/2)) right_repr = py.io.saferepr(right, maxsize=width-len(left_repr)) summary = '%s %s %s' % (left_repr, op, right_repr) @@ -114,9 +115,9 @@ raise except: excinfo = py.code.ExceptionInfo() - explanation = ['(pytest_assertion plugin: representation of ' - 'details failed. Probably an object has a faulty __repr__.)', - str(excinfo)] + explanation = [ + '(pytest_assertion plugin: representation of details failed. ' + 'Probably an object has a faulty __repr__.)', str(excinfo)] if not explanation: return None @@ -132,7 +133,7 @@ """ explanation = [] if not verbose: - i = 0 # just in case left or right has zero length + i = 0 # just in case left or right has zero length for i in range(min(len(left), len(right))): if left[i] != right[i]: break @@ -166,13 +167,15 @@ (i, left[i], right[i])] break if len(left) > len(right): - explanation += ['Left contains more items, ' - 'first extra item: %s' % py.io.saferepr(left[len(right)],)] + explanation += [ + 'Left contains more items, first extra item: %s' % + py.io.saferepr(left[len(right)],)] elif len(left) < len(right): - explanation += ['Right contains more items, ' - 'first extra item: %s' % py.io.saferepr(right[len(left)],)] - return explanation # + _diff_text(py.std.pprint.pformat(left), - # py.std.pprint.pformat(right)) + explanation += [ + 'Right contains more items, first extra item: %s' % + py.io.saferepr(right[len(left)],)] + return explanation # + _diff_text(py.std.pprint.pformat(left), + # py.std.pprint.pformat(right)) def _compare_eq_set(left, right, verbose=False): @@ -210,12 +213,12 @@ if extra_left: explanation.append('Left contains more items:') explanation.extend(py.std.pprint.pformat( - dict((k, left[k]) for k in extra_left)).splitlines()) + dict((k, left[k]) for k in extra_left)).splitlines()) extra_right = set(right) - set(left) if extra_right: explanation.append('Right contains more items:') explanation.extend(py.std.pprint.pformat( - dict((k, right[k]) for k in extra_right)).splitlines()) + dict((k, right[k]) for k in extra_right)).splitlines()) return explanation https://bitbucket.org/hpk42/pytest/commits/3c1ac0bc7557/ Changeset: 3c1ac0bc7557 User: flub Date: 2013-04-28 21:57:52 Summary: Ingore rope auto-generated files Affected #: 1 file diff -r e7240388f09d3a2fc3feacb926c601f0c44544b1 -r 3c1ac0bc755735a89375fd747608abfa1e65eaf8 .hgignore --- a/.hgignore +++ b/.hgignore @@ -25,3 +25,4 @@ .tox .cache .coverage +.ropeproject https://bitbucket.org/hpk42/pytest/commits/375daef33f80/ Changeset: 375daef33f80 User: flub Date: 2013-04-28 21:59:10 Summary: Treat frozenset as a set Thanks to Brianna Laugher. Affected #: 2 files diff -r 3c1ac0bc755735a89375fd747608abfa1e65eaf8 -r 375daef33f804b26fdb2e572d1b4fed3e186515b _pytest/assertion/util.py --- a/_pytest/assertion/util.py +++ b/_pytest/assertion/util.py @@ -94,7 +94,7 @@ issequence = lambda x: isinstance(x, (list, tuple)) istext = lambda x: isinstance(x, basestring) isdict = lambda x: isinstance(x, dict) - isset = lambda x: isinstance(x, set) + isset = lambda x: isinstance(x, (set, frozenset)) verbose = config.getoption('verbose') explanation = None diff -r 3c1ac0bc755735a89375fd747608abfa1e65eaf8 -r 375daef33f804b26fdb2e572d1b4fed3e186515b testing/test_assertion.py --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -99,6 +99,11 @@ expl = callequal(set([0, 1]), set([0, 2])) assert len(expl) > 1 + def test_frozenzet(self): + expl = callequal(frozenset([0, 1]), set([0, 2])) + print expl + assert len(expl) > 1 + def test_list_tuples(self): expl = callequal([], [(1,2)]) assert len(expl) > 1 Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org http://mail.python.org/mailman/listinfo/pytest-commit