fix: validate branch inputs (empty names, negative versions)

This commit is contained in:
Brendan Clement
2026-06-03 09:57:45 -07:00
parent 1ee490d125
commit 735a7ce6fe
4 changed files with 83 additions and 1 deletions

View File

@@ -942,6 +942,18 @@ def test_branches(tmp_path):
assert "exp" not in table.branches.list()
def test_branch_name_validation(tmp_path):
db = lancedb.connect(tmp_path)
table = db.create_table("t", [{"id": 1}])
with pytest.raises(ValueError, match="non-empty"):
table.branches.create("")
with pytest.raises(ValueError, match="non-empty"):
table.branches.checkout("")
with pytest.raises(ValueError, match="non-empty"):
table.branches.delete("")
def test_branches_preserve_namespace(tmp_path):
pytest.importorskip(
"lance"