guan404ming commented on code in PR #70302:
URL: https://github.com/apache/airflow/pull/70302#discussion_r3708919258
##########
providers/common/ai/src/airflow/providers/common/ai/utils/file_analysis.py:
##########
@@ -18,11 +18,13 @@
from __future__ import annotations
+import bz2
import csv
import gzip
import io
import json
import logging
+import lzma
Review Comment:
Good catch, fixed. Imports now guarded; missing codecs fall back to the
unsupported-compression error.
##########
providers/common/ai/tests/unit/common/ai/utils/test_file_analysis.py:
##########
@@ -378,19 +382,29 @@ def
test_detect_file_format_rejects_unsupported_compression(self, tmp_path):
with pytest.raises(LLMFileAnalysisUnsupportedFormatError,
match="Compression"):
detect_file_format(ObjectStoragePath(str(path)))
- @pytest.mark.parametrize("filename", ["sample.parquet.gz",
"sample.avro.gz", "sample.png.gz"])
- def
test_detect_file_format_rejects_unsupported_gzip_format_combinations(self,
tmp_path, filename):
+ @pytest.mark.parametrize(
+ "filename", ["sample.parquet.gz", "sample.avro.bz2", "sample.png.xz",
"sample.pdf.gz"]
+ )
+ def
test_detect_file_format_rejects_unsupported_compression_format_combinations(self,
tmp_path, filename):
path = tmp_path / filename
path.write_bytes(b"content")
with pytest.raises(LLMFileAnalysisUnsupportedFormatError, match="not
supported for"):
Review Comment:
Fixed, tightened the match to pin the format-combination branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]