kleister-nda/run.py
Mikołaj Pokrywka 690cc56516 444463
2022-05-04 19:12:51 +02:00

46 lines
2.0 KiB
Python

import lzma
import re
if __name__ == "__main__":
reg = re.compile("Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|Florida|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virginia|Washington|West Virginia|Wisconsin|Wyoming")
expected = []
with lzma.open('dev-0/in.tsv.xz', 'r') as file:
for line in file:
line = line.strip()
state = re.search(reg, line.decode("utf-8"))
if not state:
result = f"effective_date=2014-05-20 jurisdiction=Colorado party=Liquidmetal_Technology_Inc. party=Visser_Precision_Cast_LLC term=3_years"
else:
state = state.group()
state = state.replace(' ', "_")
result = f"effective_date=2014-05-20 jurisdiction={state} party=Liquidmetal_Technology_Inc. party=Visser_Precision_Cast_LLC term=3_years"
expected.append(result)
f = open("dev-0/out.tsv", "a")
for p in expected:
f.write(str(p) + '\n')
f.close()
expected = []
with lzma.open('test-A/in.tsv.xz', 'r') as file:
for line in file:
line = line.strip()
state = re.search(reg, line.decode("utf-8"))
if not state:
result = f"effective_date=2014-05-20 jurisdiction=Colorado party=Liquidmetal_Technology_Inc. party=Visser_Precision_Cast_LLC term=3_years"
else:
state = state.group()
state = state.replace(' ', "_")
result = f"effective_date=2014-05-20 jurisdiction={state} party=Liquidmetal_Technology_Inc. party=Visser_Precision_Cast_LLC term=3_years"
expected.append(result)
f = open("test-A/out.tsv", "a")
for p in expected:
f.write(str(p) + '\n')
f.close()