def test_write_high(tmp_path) -> None: """High bits set.""" bit_string = "11000000" zoon = Zoon(bit_string) bit_path = tmp_path / "bits" zoon.write(bit_path) assert bit_path.read_bytes() == to_bytes(bit_string)
def test_write_missing(tmp_path) -> None: """0-pad on the right.""" bit_string = "000011" zoon = Zoon(bit_string) bit_path = tmp_path / "bits" zoon.write(bit_path) assert bit_path.read_bytes() == to_bytes(bit_string)
def test_write_low(tmp_path) -> None: """Low bits set.""" bit_string = "00000011" zoon = Zoon(bit_string) bit_path = tmp_path / "bits" zoon.write(bit_path) assert bit_path.read_bytes() == to_bytes(bit_string)
def test_write_bad_dir() -> None: """Write to a non-existent path.""" true = pwhich("true") zoon = Zoon(true) with pytest.raises(FileNotFoundError): zoon.write(Path("/u/jane/me/tarzan"))