test mastermap filtering works

This commit is contained in:
Ed Chalstrey 2022-03-18 15:04:09 +00:00
parent b875e27fb8
commit 35f85ee2ed
3 changed files with 12 additions and 3 deletions

View File

@ -1,8 +1,12 @@
import csv
import pytest
from etl import filter_mastermap
def test_filter_mastermap():
"""Test that MasterMap CSV can be correctly filtered to include only buildings."""
input_file = ""
expected_output = ""
assert filter_mastermap(input_file) == expected_output
input_file = "tests/test_mastermap.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

View File

@ -0,0 +1,2 @@
WKT,fid,descriptiveGroup
"POLYGON ((484704.003 184721.2,484691.62 184729.971,484688.251 184725.214,484700.633 184716.443,484704.003 184721.2))",osgb5000005129953843,"[ ""Building"" ]"
1 WKT fid descriptiveGroup
2 POLYGON ((484704.003 184721.2,484691.62 184729.971,484688.251 184725.214,484700.633 184716.443,484704.003 184721.2)) osgb5000005129953843 [ "Building" ]

View File

@ -0,0 +1,3 @@
WKT,fid,descriptiveGroup
"POLYGON ((484704.003 184721.2,484691.62 184729.971,484688.251 184725.214,484700.633 184716.443,484704.003 184721.2))",osgb5000005129953843,"[ ""Building"" ]"
"POLYGON ((484703.76 184849.9,484703.46 184849.7,484703.26 184849.4,484703.06 184849.2,484702.86 184848.9,484702.76 184848.6,484702.66 184848.2,484702.66 184847.3,484702.76 184847.0,484702.96 184846.7,484703.06 184846.4,484703.36 184846.2,484703.56 184846.0,484704.16 184845.6,484704.46 184845.5,484705.46 184845.5,484706.06 184845.7,484706.26 184845.8,484706.76 184846.3,484706.96 184846.6,484707.16 184846.8,484707.26 184847.2,484707.36 184847.5,484707.36 184848.4,484707.26 184848.7,484707.16 184848.9,484706.76 184849.5,484706.46 184849.7,484706.26 184849.9,484705.66 184850.2,484704.66 184850.2,484703.76 184849.9))",osgb1000000152730957,"[ ""General Surface"" ]"
1 WKT fid descriptiveGroup
2 POLYGON ((484704.003 184721.2,484691.62 184729.971,484688.251 184725.214,484700.633 184716.443,484704.003 184721.2)) osgb5000005129953843 [ "Building" ]
3 POLYGON ((484703.76 184849.9,484703.46 184849.7,484703.26 184849.4,484703.06 184849.2,484702.86 184848.9,484702.76 184848.6,484702.66 184848.2,484702.66 184847.3,484702.76 184847.0,484702.96 184846.7,484703.06 184846.4,484703.36 184846.2,484703.56 184846.0,484704.16 184845.6,484704.46 184845.5,484705.46 184845.5,484706.06 184845.7,484706.26 184845.8,484706.76 184846.3,484706.96 184846.6,484707.16 184846.8,484707.26 184847.2,484707.36 184847.5,484707.36 184848.4,484707.26 184848.7,484707.16 184848.9,484706.76 184849.5,484706.46 184849.7,484706.26 184849.9,484705.66 184850.2,484704.66 184850.2,484703.76 184849.9)) osgb1000000152730957 [ "General Surface" ]