test: fix operator precedence in manifest v2 assertions (#3612)

Six assertions in test_write_manifest and test_write_manifest_list used
the form `assert x == a if format_version == 1 else b`. Because a
conditional expression binds looser than `==`, Python parses this as
`assert (x == a) if (format_version == 1) else b`, so for the
format_version == 2 parametrization the whole statement collapses to
`assert b`, where b is a truthy constant (3, or ManifestContent.DELETES).
The v2 branch therefore always passed and never compared the actual
value read back from the manifest.

Wrap the right-hand side in parentheses so the conditional expression is
the comparison target. This restores verification of the v2
sequence_number, content, min_sequence_number, and file_sequence_number
on the manifest read/round-trip path. Test-only change; all parametrized
cases (v1 and v2) pass.

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
1 file changed
tree: 35cf52adfee76e6e80d9853a47581ae39f113b98
  1. .github/
  2. dev/
  3. mkdocs/
  4. notebooks/
  5. pyiceberg/
  6. tests/
  7. vendor/
  8. .asf.yaml
  9. .codespellrc
  10. .gitignore
  11. .markdownlint.yaml
  12. .pre-commit-config.yaml
  13. AGENTS.md
  14. LICENSE
  15. Makefile
  16. MANIFEST.in
  17. NOTICE
  18. pyproject.toml
  19. README.md
  20. ruff.toml
  21. SECURITY-THREAT-MODEL.md
  22. setup.py
  23. uv.lock
README.md

Iceberg Python

PyIceberg is a Python library for programmatic access to Iceberg table metadata as well as to table data in Iceberg format. It is a Python implementation of the Iceberg table spec.

The documentation is available at https://py.iceberg.apache.org/.

Get in Touch