name output_file with input_file

This commit is contained in:
Ed Chalstrey 2022-03-18 15:27:12 +00:00
parent 35f85ee2ed
commit a159c974dc

View File

@ -6,7 +6,17 @@ from etl import filter_mastermap
def test_filter_mastermap():
"""Test that MasterMap CSV can be correctly filtered to include only buildings."""
input_file = "tests/test_mastermap.gml.csv" # Test csv with one building and one non-building
output_file = input_file.replace('gml', 'filtered')
filter_mastermap(input_file) # creates test_mastermap.filtered.csv
with open('tests/test_mastermap.filtered.csv', newline='') as csvfile:
with open(output_file, newline='') as csvfile:
csv_array = list(csv.reader(csvfile))
assert len(csv_array) == 2 # assert that length is 2 because just one row after header
assert len(csv_array) == 2 # assert that length is 2 because just one row after header
# def test_filter_mastermap_missing_type():
# """Test that MasterMap CSV can be correctly filtered when the polygon does not have a type specified."""
# input_file = "tests/test_mastermap_missing_type.gml.csv" # Test csv with one building and one non-building
# filter_mastermap(input_file) # creates test_mastermap.filtered.csv
# with open('tests/test_mastermap.filtered.csv', newline='') as csvfile:
# csv_array = list(csv.reader(csvfile))
# assert len(csv_array) == 2 # assert that length is 2 because just one row after header