def test_options_decode_values(self): section_header = SectionMarker.from_headerline(b"<<<" + b":".join(( b"name", b"cached(1,2)", b"encoding(ascii)", b"nostrip()", b"persist(42)", b"sep(124)", )) + b">>>") assert section_header.name == SectionName("name") assert section_header.cached == (1, 2) assert section_header.encoding == "ascii" assert section_header.nostrip is True assert section_header.persist == 42 assert section_header.separator == "|"
def test_options_deserialize_defaults(self): section_header = SectionMarker.from_headerline(b"<<<section>>>") other_header = SectionMarker.from_headerline(str(section_header).encode("ascii")) assert section_header == other_header assert str(section_header) == str(other_header)
def test_piggybacked_host_footer(self): line = b"<<<<>>>>" assert SectionMarker.is_header(line) is False assert SectionMarker.is_footer(line) is False assert PiggybackMarker.is_header(line) is False assert PiggybackMarker.is_footer(line) is True
def test_section_footer(self, line): assert SectionMarker.is_header(line) is False assert SectionMarker.is_footer(line) is True assert PiggybackMarker.is_header(line) is False assert PiggybackMarker.is_footer(line) is False