From: Alex Morega Date: Sat, 6 Jul 2013 09:34:59 +0000 (+0200) Subject: copy babel.util doctests as unit tests X-Git-Tag: 1.0~100^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34039b352e2438e932428c98c44133a8b15450f4;p=thirdparty%2Fbabel.git copy babel.util doctests as unit tests --- diff --git a/tests/test_util.py b/tests/test_util.py index 7c72b861..0c9d349d 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -16,9 +16,22 @@ import unittest from babel import util + +def test_distinct(): + assert list(util.distinct([1, 2, 1, 3, 4, 4])) == [1, 2, 3, 4] + assert list(util.distinct('foobar')) == ['f', 'o', 'b', 'a', 'r'] + + +def test_pathmatch(): + assert util.pathmatch('**.py', 'bar.py') + assert util.pathmatch('**.py', 'foo/bar/baz.py') + assert not util.pathmatch('**.py', 'templates/index.html') + assert util.pathmatch('**/templates/*.html', 'templates/index.html') + assert not util.pathmatch('**/templates/*.html', 'templates/foo/bar.html') + + def suite(): suite = unittest.TestSuite() - suite.addTest(doctest.DocTestSuite(util)) return suite if __name__ == '__main__':