diff --git a/tests/test_filter.py b/tests/test_filter.py index cf2a2083..9f4b34a8 100644 --- a/tests/test_filter.py +++ b/tests/test_filter.py @@ -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 \ No newline at end of file + 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 \ No newline at end of file diff --git a/tests/test_mastermap.filtered.csv b/tests/test_mastermap.filtered.csv new file mode 100644 index 00000000..28cc7baf --- /dev/null +++ b/tests/test_mastermap.filtered.csv @@ -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"" ]" diff --git a/tests/test_mastermap.gml.csv b/tests/test_mastermap.gml.csv new file mode 100644 index 00000000..d76a6eee --- /dev/null +++ b/tests/test_mastermap.gml.csv @@ -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"" ]" \ No newline at end of file