[Checkins] SVN: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/
Add tests for 'encoding' keyword.
Uli Fouquet
uli at gnufix.de
Tue Feb 5 11:52:59 EST 2008
Log message for revision 83538:
Add tests for 'encoding' keyword.
Changed:
U Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/README.txt
U Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/file1.txt
-=-
Modified: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/README.txt
===================================================================
--- Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/README.txt 2008-02-05 15:53:14 UTC (rev 83537)
+++ Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/README.txt 2008-02-05 16:52:58 UTC (rev 83538)
@@ -288,10 +288,34 @@
files as functional ones.
-- `encoding`: the testfiles encoding. 'utf-8' by default. Setting
- this to `None` means system default encoding (normally
- 7Bit ASCII encoding).
+- `encoding`:
+ the encoding of testfiles. 'utf-8' by default. Setting this to `None`
+ means using the default value. We've hidden one doctest file, that
+ contains umlauts. If we set the encoding to `ascii`, we get an
+ error::
+
+ >>> test_suite = z3c.testsetup.register_all_tests(
+ ... 'z3c.testsetup.tests.cave',
+ ... encoding='ascii')
+ >>> suite = test_suite()
+ Traceback (most recent call last):
+ ...
+ UnicodeDecodeError: 'ascii' codec can't decode ...: ordinal
+ not in range(128)
+
+ While using 'latin-1' will work::
+ >>> test_suite = z3c.testsetup.register_all_tests(
+ ... 'z3c.testsetup.tests.cave',
+ ... encoding='latin-1')
+ >>> suite = test_suite()
+
+ No traceback here.
+
+ You can always overwrite an encoding setting for a certain file by
+ following PEP 0263 ( http://www.python.org/dev/peps/pep-0263/ ).
+
+
- `checker`: An output checker for functional doctests. `None` by
default. A typical output checker can be created like
this::
Modified: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/file1.txt
===================================================================
--- Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/file1.txt 2008-02-05 15:53:14 UTC (rev 83537)
+++ Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/file1.txt 2008-02-05 16:52:58 UTC (rev 83538)
@@ -5,3 +5,8 @@
This is only an example file.
:Test-Layer: functional
+
+with umlauts:
+
+ >>> a = u'äöüÃÃÃ'
+
More information about the Checkins
mailing list