def test_not_parquet_file(self): """Test reading a non-parquet file.""" with tempfile.NamedTemporaryFile() as t: t.write(b"blah") t.flush() self.assertFalse(parquet._check_header_magic_bytes(t)) self.assertFalse(parquet._check_footer_magic_bytes(t))
def test_header_magic_bytes(self): with tempfile.NamedTemporaryFile() as t: t.write("PAR1_some_bogus_data") t.flush() self.assertTrue(parquet._check_header_magic_bytes(t))
def detect_parquet(fhandle): """ Detect parquet from magic header bytes. """ return parquet._check_header_magic_bytes(fhandle)