Reinstate Python 2 compatibility.

This commit is contained in:
Robert Smallshire
2015-01-31 16:00:14 +01:00
parent 38511e67ba
commit 4862f347df
7 changed files with 71 additions and 59 deletions
+5 -4
View File
@@ -7,6 +7,7 @@ from hypothesis.searchstrategy import MappedSearchStrategy, StringStrategy
from hypothesis.strategytable import StrategyTable
from segpy.encoding import EBCDIC, ASCII
from segpy.toolkit import format_extended_textual_header, CARDS_PER_HEADER, END_TEXT_STANZA, CARD_LENGTH
from segpy.portability import unicode
# class MultiLineString(str):
@@ -31,28 +32,28 @@ from segpy.toolkit import format_extended_textual_header, CARDS_PER_HEADER, END_
class TestFormatExtendedTextualHeader(unittest.TestCase):
@given(str,
@given(unicode,
sampled_from([ASCII, EBCDIC]),
bool)
def test_forty_lines_per_page(self, text, encoding, include_text_stop):
pages = format_extended_textual_header(text, encoding, include_text_stop)
self.assertTrue(all(len(page) == CARDS_PER_HEADER for page in pages))
@given(str,
@given(unicode,
sampled_from([ASCII, EBCDIC]),
bool)
def test_eighty_bytes_per_encoded_line(self, text, encoding, include_text_stop):
pages = format_extended_textual_header(text, encoding, include_text_stop)
self.assertTrue(all([len(line.encode(encoding)) == CARD_LENGTH for page in pages for line in page]))
@given(str,
@given(unicode,
sampled_from([ASCII, EBCDIC]),
bool)
def test_lines_end_with_cr_lf(self, text, encoding, include_text_stop):
pages = format_extended_textual_header(text, encoding, include_text_stop)
self.assertTrue(all([line.endswith('\r\n') for page in pages for line in page]))
@given(str,
@given(unicode,
sampled_from([ASCII, EBCDIC]),
just(True))
def test_lines_end_with_cr_lf(self, text, encoding, include_text_stop):