mirror of
https://github.com/wassname/segpy.git
synced 2026-09-09 11:34:00 +08:00
Reinstate Python 2 compatibility.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user