From 0af90e0962fde4532f773ac661cb63c051c38c37 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Thu, 16 Sep 2010 01:07:53 +0100 Subject: [PATCH] Add specialised explanations to the demo This currently breaks the test_failuers.py example as that file counts the number of failures in the demo. But this demo isn't fixed yet so we'll leave it for now. --HG-- branch : trunk --- doc/example/assertion/failure_demo.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/example/assertion/failure_demo.py b/doc/example/assertion/failure_demo.py index 5fba99db7..b99253ee8 100644 --- a/doc/example/assertion/failure_demo.py +++ b/doc/example/assertion/failure_demo.py @@ -118,5 +118,25 @@ def test_dynamic_compile_shows_nicely(): module.foo() +class TestSpecialisedExplanations(object): + def test_eq_text(self): + assert 'spam' == 'eggs' + + def test_eq_similar_text(self): + assert 'foo 1 bar' == 'foo 2 bar' + + def test_eq_multiline_text(self): + assert 'foo\nspam\nbar' == 'foo\neggs\nbar' + + def test_eq_list(self): + assert [0, 1, 2] == [0, 1, 3] + + def test_eq_dict(self): + assert {'a': 0, 'b': 1} == {'a': 0, 'b': 2} + + def test_eq_set(self): + assert set([0, 10, 11, 12]) == set([0, 20, 21]) + + def globf(x): return x+1