/usr/share/pyshared/zope/ucol/tests.py is in python-zope.ucol 1.0.2-2ubuntu6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | ##############################################################################
#
# Copyright (c) 2004 Zope Corporation 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.
#
##############################################################################
"""XXX short summary goes here.
$Id: tests.py 40673 2005-12-09 22:09:28Z jim $
"""
import unittest
from zope.testing import doctest
def type_errors():
"""
You can pass unicode strings, or strings:
>>> from zope.ucol import Collator
>>> c = Collator('root')
>>> c.key(u"Hello") == c.key("Hello")
True
>>> c.cmp(u"Hello", "Hello")
0
As long as the strings can be decoded as ASCII:
>>> c.key("Hello\xfa")
Traceback (most recent call last):
...
UnicodeDecodeError: 'ascii' codec can't decode byte
0xfa in position 5: ordinal not in range(128)
>>> c.cmp(u"Hello", "Hello\xfa")
Traceback (most recent call last):
...
UnicodeDecodeError: 'ascii' codec can't decode byte
0xfa in position 5: ordinal not in range(128)
And you can't pass a non-string:
>>> c.key(0)
Traceback (most recent call last):
...
TypeError: Expected unicode string
>>> c.cmp(u"Hello", 0)
Traceback (most recent call last):
...
TypeError: Expected unicode string
"""
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite(optionflags=doctest.NORMALIZE_WHITESPACE),
doctest.DocFileSuite('README.txt',
optionflags=doctest.NORMALIZE_WHITESPACE),
doctest.DocTestSuite('zope.ucol.localeadapter')
))
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
|