Serhiy Storchaka added the comment:

Ezio, is it a good factorization?

    def check(self, coder):
        def checker(input, expect):
            self.assertEqual(coder(input), (expect, len(input)))
        return checker

    def test_escape_decode(self):
        decode = codecs.unicode_escape_decode
        check = self.check(decode)
        check(b"[\\\n]", "[]")
        check(br'[\"]', '["]')
        check(br"[\']", "[']")
        # other 20 checks ...

And same for test_escape_encode and for bytes escape decoder.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16979>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to