def test_underlines_in_numbers_are_handled_by_python(self): loader = bytes_loader(BytesIO(b"50\n123_000.9\n70\n456_000\n")) msg = [] tags = list(byte_tag_compiler(loader, messages=msg)) assert tags[0] == (50, 123000.9) assert tags[1] == (70, 456000) assert len(msg) == 0
def test_malformed_value_tags(self): loader = bytes_loader(BytesIO(MALFORMED_VALUE_TAGS)) tags = list(byte_tag_compiler(loader)) assert tags[0] == (70, 42) assert tags[1] == (40, 47.11) assert tags[2] == (10, (1, 1, 1)) assert tags[3] == (11, (2, 2))
def test_bytes_loader(): filename = fullpath(RECOVER1) with open(filename, 'rb') as fp: tags = list(recover.bytes_loader(fp)) assert len(tags) == 14736
def test_linux_and_macos_x_line_endings_LF(self, loader): tags = list(bytes_loader(BytesIO(b"0\n1\n0\n2\n"))) assert tags == [ (0, b"1"), (0, b"2"), ], "Linux and MacOS X line endings LF must be supported."
def test_spaces_in_floats_returns_invalid_value(self): loader = bytes_loader(BytesIO(b"50\n1.000 e20\n")) msg = [] tags = list(byte_tag_compiler(loader, messages=msg)) assert tags[0] == (50, 1), "invalid interpretation" assert msg[0][0] == AuditError.INVALID_FLOATING_POINT_VALUE
def test_malformed_integer_tags(self): loader = bytes_loader(BytesIO(b"70\n123x\n")) msg = [] tags = list(byte_tag_compiler(loader, messages=msg)) assert tags[0] == (70, 123) assert msg[0][0] == AuditError.INVALID_INTEGER_VALUE
def test_bytes_loader(filename01): with open(filename01, 'rb') as fp: tags = list(recover.bytes_loader(fp)) assert len(tags) == 14736
def test_line_endings_only_CR(self): with pytest.raises(const.DXFStructureError): list(bytes_loader(BytesIO(b"0\r1\r0\r2\r"))) assert list(synced_bytes_loader(BytesIO(b"0\r1\r0\r2\r"))) == [], \ "MacOS prior to MacOS X line endings CR are not supported."
def load_bytes(): with open(BIG_FILE, 'rb') as fp: list(bytes_loader(fp))