S
Stuart D. Gathman
I am trying to create a doctest test case for the following:
def quote_value(s):
"""Quote the value for a key-value pair in Received-SPF header field
if needed. No quoting needed for a dot-atom value.
'"-all\\\\\\\\x00"'
...
However, doctest does *not* like the null byte in the example (yes, this
happens with real life input):
**********************************************************************
File "/home/stuart/pyspf/spf.py", line 1453, in spf.quote_value
Failed example:
quote_value('-all')
Exception raised:
Traceback (most recent call last):
File "/var/tmp/python2.4-2.4.4c1-root/usr/lib/python2.4/doctest.py",
line 1248, in __run
compileflags, 1) in test.globs
TypeError: compile() expected string without null bytes
**********************************************************************
How can I construct a test cast for this?
def quote_value(s):
"""Quote the value for a key-value pair in Received-SPF header field
if needed. No quoting needed for a dot-atom value.
'"-all\\\\\\\\x00"'
...
However, doctest does *not* like the null byte in the example (yes, this
happens with real life input):
**********************************************************************
File "/home/stuart/pyspf/spf.py", line 1453, in spf.quote_value
Failed example:
quote_value('-all')
Exception raised:
Traceback (most recent call last):
File "/var/tmp/python2.4-2.4.4c1-root/usr/lib/python2.4/doctest.py",
line 1248, in __run
compileflags, 1) in test.globs
TypeError: compile() expected string without null bytes
**********************************************************************
How can I construct a test cast for this?