[Checkins] SVN: zope.testbrowser/trunk/ Revert r123163, this package is not the proper place for this functionality. It moved to gocept.testing
Wolfgang Schnerring
wosc at wosc.de
Wed Nov 2 15:05:09 UTC 2011
Log message for revision 123247:
Revert r123163, this package is not the proper place for this functionality. It moved to gocept.testing
Changed:
U zope.testbrowser/trunk/CHANGES.txt
D zope.testbrowser/trunk/src/zope/testbrowser/assertion.py
D zope.testbrowser/trunk/src/zope/testbrowser/tests/test_assertion.py
-=-
Modified: zope.testbrowser/trunk/CHANGES.txt
===================================================================
--- zope.testbrowser/trunk/CHANGES.txt 2011-11-02 01:52:09 UTC (rev 123246)
+++ zope.testbrowser/trunk/CHANGES.txt 2011-11-02 15:05:08 UTC (rev 123247)
@@ -12,9 +12,6 @@
environment by setting it to ``None`` when ``Browser.handleErrors`` is
``True``. This makes it easier to test error pages.
-- Add assertion helper that provides ``assertEllipsis`` and
- ``assertNotEllipsis``.
-
4.0.2 (2011-05-25)
------------------
Deleted: zope.testbrowser/trunk/src/zope/testbrowser/assertion.py
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/assertion.py 2011-11-02 01:52:09 UTC (rev 123246)
+++ zope.testbrowser/trunk/src/zope/testbrowser/assertion.py 2011-11-02 15:05:08 UTC (rev 123247)
@@ -1,50 +0,0 @@
-#############################################################################
-#
-# Copyright (c) 2011 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import difflib
-import doctest
-
-
-class Ellipsis(object):
- """Assertion helper that provides doctest-style ellipsis matching.
-
- Inherit from this class in additition to unittest.TestCase.
-
- For convenience when using this with a zope.testbrowser, if no ``actual``
- value is provided, ``self.browser.contents`` is used.
- """
-
- def assertEllipsis(self, expected, actual=None):
- if actual is None:
- actual = self.browser.contents
- # normalize whitespace
- norm_expected = ' '.join(expected.split())
- norm_actual = ' '.join(actual.split())
- if doctest._ellipsis_match(norm_expected, norm_actual):
- return True
- # report ndiff
- engine = difflib.Differ(charjunk=difflib.IS_CHARACTER_JUNK)
- diff = list(engine.compare(expected.splitlines(True),
- actual.splitlines(True)))
- kind = 'ndiff with -expected +actual'
- diff = [line.rstrip() + '\n' for line in diff]
- self.fail('Differences (%s):\n' % kind + ''.join(diff))
-
- def assertNotEllipsis(self, expected, actual=None):
- try:
- self.assertEllipsis(expected, actual)
- except AssertionError:
- pass
- else:
- self.fail('Value unexpectedly matches expression %r.' % expected)
Deleted: zope.testbrowser/trunk/src/zope/testbrowser/tests/test_assertion.py
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/tests/test_assertion.py 2011-11-02 01:52:09 UTC (rev 123246)
+++ zope.testbrowser/trunk/src/zope/testbrowser/tests/test_assertion.py 2011-11-02 15:05:08 UTC (rev 123247)
@@ -1,54 +0,0 @@
-#############################################################################
-#
-# Copyright (c) 2011 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-import zope.testbrowser.assertion
-
-
-class EllipsisTest(unittest.TestCase, zope.testbrowser.assertion.Ellipsis):
-
- def test_match_found_nothing_happens(self):
- # assert nothing is raised
- self.assertEllipsis('...bar...', 'foo bar baz')
-
- def test_no_match_found_fails(self):
- try:
- self.assertEllipsis('foo', 'bar')
- except AssertionError, e:
- self.assertEqual(
- 'Differences (ndiff with -expected +actual):\n- foo\n+ bar\n',
- str(e))
- else:
- self.fail('nothing raised')
-
- def test_unicode_matches_encoded(self):
- # assert nothing is raised
- self.assertEllipsis(u'...bar...', u'foo bar baz'.encode('utf-8'))
-
- def test_encoded_matches_unicode(self):
- # assert nothing is raised
- self.assertEllipsis(u'...bar...'.encode('utf-8'), u'foo bar baz')
-
- def test_inverse_assertion(self):
- # assert nothing is raised
- self.assertNotEllipsis('foo', 'bar')
-
- try:
- self.assertNotEllipsis('...bar...', 'foo bar baz')
- except AssertionError, e:
- self.assertEqual(
- "Value unexpectedly matches expression '...bar...'.",
- str(e))
- else:
- self.fail('nothing raised')
More information about the checkins
mailing list