def test_cache_gz(self): dirname, filename_gz = create_testdir_and_filename( self, "cached.fragments.gz") with gzip.open(filename_gz, "wb") as outfile: with open(CACHED_FRAGMENTS, "rb") as infile: outfile.write(infile.read()) self._test_cache(filename_gz)
def test_output_to_fraginfo(self): dirname, filename = create_testdir_and_filename( self, "output.fraginfo") fragment_to_stdout(SPACE_SMI, "--output", filename, "--delimiter", "to-eol") with open(filename) as infile: content = infile.read() self.assertIn("#heavies", content)
def test_output_to_fragments(self): dirname, filename = create_testdir_and_filename( self, "output.fragments") fragment_to_stdout(SPACE_SMI, "--output", filename, "--delimiter", "to-eol") reader = fragment_io.read_fragment_records(filename) records = list(reader) self._check_record(records[0], "record 1", "Oc1ccccc1O")
def test_output_to_fraginfo_gz(self): dirname, filename = create_testdir_and_filename(self, "output.fraginfo.gz") fragment_to_stdout(SPACE_SMI, "--output", filename, "--delimiter", "to-eol") with open(filename, "rb") as infile: text = infile.read(4) self.assertEqual(text, b"\x1f\x8b\x08\x08") with gzip.open(filename) as infile: content = infile.read() self.assertIn(b"#heavies", content)
def test_output_to_fragments_gz(self): dirname, filename = create_testdir_and_filename(self, "output.fragments.gz") fragment_to_stdout(SPACE_SMI, "--output", filename, "--delimiter", "to-eol") with open(filename, "rb") as infile: text = infile.read(4) self.assertEqual(text, b"\x1f\x8b\x08\x08") reader = fragment_io.read_fragment_records(filename) records = list(reader) self._check_record(records[0], "record 1", "Oc1ccccc1O")