Skip to content

Commit 541db34

Browse files
committed
fix: wizard formatting + test status string fix
1 parent 9eab9fe commit 541db34

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

redisvl/migration/wizard.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ def _filter_staged_adds(
130130
]
131131
return filtered
132132

133-
134133
def _apply_staged_changes(
135134
self,
136135
source_schema: Dict[str, Any],
@@ -225,9 +224,7 @@ def _build_patch(
225224
staged_add_names = {f["name"] for f in changes.add_fields}
226225
if field_name in staged_add_names:
227226
changes.add_fields = [
228-
f
229-
for f in changes.add_fields
230-
if f["name"] != field_name
227+
f for f in changes.add_fields if f["name"] != field_name
231228
]
232229
print(f"Cancelled staged addition of '{field_name}'.")
233230
else:

tests/unit/test_migration_wizard.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,9 @@ def test_negative_m_ignored(self, monkeypatch):
652652
wizard = MigrationWizard()
653653
patch = wizard._build_patch(source_schema)
654654

655-
update = patch.changes.update_fields[0]
656-
assert "m" not in update.attrs # Negative should be ignored
655+
# Negative M is ignored, and since algorithm/datatype/metric are unchanged,
656+
# no update should be generated at all
657+
assert len(patch.changes.update_fields) == 0
657658

658659
def test_float_m_ignored(self, monkeypatch):
659660
"""Test that float M value is ignored."""
@@ -678,8 +679,9 @@ def test_float_m_ignored(self, monkeypatch):
678679
wizard = MigrationWizard()
679680
patch = wizard._build_patch(source_schema)
680681

681-
update = patch.changes.update_fields[0]
682-
assert "m" not in update.attrs
682+
# Float M is ignored, and since algorithm/datatype/metric are unchanged,
683+
# no update should be generated at all
684+
assert len(patch.changes.update_fields) == 0
683685

684686
def test_string_m_ignored(self, monkeypatch):
685687
"""Test that string M value is ignored."""
@@ -704,8 +706,9 @@ def test_string_m_ignored(self, monkeypatch):
704706
wizard = MigrationWizard()
705707
patch = wizard._build_patch(source_schema)
706708

707-
update = patch.changes.update_fields[0]
708-
assert "m" not in update.attrs
709+
# String M is ignored, and since algorithm/datatype/metric are unchanged,
710+
# no update should be generated at all
711+
assert len(patch.changes.update_fields) == 0
709712

710713
def test_zero_m_accepted(self, monkeypatch):
711714
"""Test that zero M is accepted (validation happens at schema level)."""

0 commit comments

Comments
 (0)