Imported modules
|
|
from Martel import RecordReader
from cStringIO import StringIO
from mx import TextTools
import string
|
Functions
|
|
|
|
count_records
|
count_records ( reader )
|
|
normalize
|
normalize ( s )
Notice how this omits the final newline?
|
|
test
|
test ()
|
|
test_count_lines
|
test_count_lines ()
Create a set of i lines and read count lines at a time.
Either count divides i or it doesn't. If it does, the reader
should go to completion. If it does not, the reader should
have a remainder whose size can be verified.
Exceptions
|
|
AssertionError, "Got unexpected final record, %r" % rec
|
|
|
test_endswith
|
test_endswith ()
|
|
test_endswith_SP
|
test_endswith_SP ()
|
|
test_endswith_errors
|
test_endswith_errors ()
Check the failure cases.
Exceptions
|
|
AssertionError, "should not get here with %r" % s
|
|
|
test_endswith_exhaustive
|
test_endswith_exhaustive ( ending )
|
|
test_endswith_generic
|
test_endswith_generic ()
|
|
test_endswith_remainder
|
test_endswith_remainder ()
|
|
test_everything
|
test_everything ()
|
|
test_nothing
|
test_nothing ()
|
|
test_startswith
|
test_startswith ()
|
|
test_startswith_SP
|
test_startswith_SP ()
|
|
test_startswith_errors
|
test_startswith_errors ()
Check the failure cases. Actually, there's only one.
Exceptions
|
|
AssertionError, "should not allow %r" % s
AssertionError, "should not get here"
|
|
|
test_startswith_exhaustive
|
test_startswith_exhaustive ( ending )
|
|
test_startswith_generic
|
test_startswith_generic ()
|
|
test_startswith_remainder
|
test_startswith_remainder ()
|
|
test_until
|
test_until ()
Don't need to do that much testing since the code is built on
top of the StartsWith reader, which has already been tested.
|