Files
flow/scripts/ci/test_constraint_preservation.py
zeekay d650dd60f0 refactor(rebrand): langflow->flow across docs, starter-project data, CI, tests
Docs corpus (Langflow->Hanzo Flow, upstream URLs langflow-ai/langflow->hanzoai/
flow, docs.langflow.org->docs.hanzo.ai), starter-project template help-URLs, CI
workflows, and test files. Remaining 'langflow' repo-wide is now dominated by
LANGFLOW_* env-var names + langflow_ settings fields — the config-boundary layer
deliberately preserved pending a coordinated FLOW_/HANZO_ alias-with-fallback
(renaming them blind breaks every deployment).
2026-07-16 10:00:51 -07:00

43 lines
1.2 KiB
Python

import subprocess
# Simulate the sed pattern from release.yml
# The pattern should preserve trailing commas
SED_PATTERN = 's|"flow-base[^"]*"|"flow-base[complete]>=0.8.0.rc3,<1.dev0"|g'
TEST_CASES = [
' "flow-base[complete]~=0.8.0",',
' "flow-base~=0.8.0",',
' "flow-base[openai]~=0.8.0",',
' "flow-base[complete]>=0.8.0,<1.dev0",',
' "flow-base[complete]>=0.8.0.rc2,<1.dev0",',
]
EXPECTED = ' "flow-base[complete]>=0.8.0.rc3,<1.dev0",'
def run_sed(input_line):
"""Run sed on input line and return the result."""
# Use sed with stdin/stdout instead of file operations
result = subprocess.run( # noqa: S603
["sed", SED_PATTERN], # noqa: S607
input=input_line,
capture_output=True,
text=True,
check=True,
)
# Use rstrip() to only remove trailing whitespace (newline), preserve leading spaces
return result.stdout.rstrip()
def test_all():
for i, case in enumerate(TEST_CASES):
output = run_sed(case)
if output != EXPECTED:
msg = f"Test case {i + 1} failed: {case} → {output}"
raise AssertionError(msg)
print("All sed constraint preservation tests passed.")
if __name__ == "__main__":
test_all()