proper test for merge fix for organization_id setting
This commit is contained in:
32
fix_quotes_json.py
Normal file
32
fix_quotes_json.py
Normal file
@ -0,0 +1,32 @@
|
||||
import json
|
||||
|
||||
with open("fixtures/merger.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
test_case = data[0]["tests"][-1]
|
||||
|
||||
for j, sql_group in enumerate(test_case["expect"]["sql"]):
|
||||
new_group = []
|
||||
i = 0
|
||||
while i < len(sql_group):
|
||||
s = sql_group[i]
|
||||
if s.strip() == "'{":
|
||||
if i + 2 < len(sql_group):
|
||||
next_line = sql_group[i+1].strip()
|
||||
next_next_line = sql_group[i+2].strip()
|
||||
if next_next_line == "}',":
|
||||
# Reconstruct
|
||||
new_group.append(f" '{next_line}',")
|
||||
i += 3
|
||||
continue
|
||||
elif next_next_line == "}'":
|
||||
new_group.append(f" '{next_line}'")
|
||||
i += 3
|
||||
continue
|
||||
new_group.append(s)
|
||||
i += 1
|
||||
test_case["expect"]["sql"][j] = new_group
|
||||
|
||||
with open("fixtures/merger.json", "w") as f:
|
||||
json.dump(data, f, indent=2)
|
||||
|
||||
Reference in New Issue
Block a user