From 158a09637b70813119bee3d7ddc896ca1aaeae40 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Fri, 18 Mar 2022 15:30:17 +0000 Subject: [PATCH] add failing test for missing mastermap type --- tests/test_filter.py | 15 ++++++++------- tests/test_mastermap_missing_type.gml.csv | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 tests/test_mastermap_missing_type.gml.csv diff --git a/tests/test_filter.py b/tests/test_filter.py index ed785013..aae7842d 100644 --- a/tests/test_filter.py +++ b/tests/test_filter.py @@ -13,10 +13,11 @@ def test_filter_mastermap(): 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 \ No newline at end of file +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 + output_file = input_file.replace('gml', 'filtered') + filter_mastermap(input_file) # creates test_mastermap.filtered.csv + 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 \ No newline at end of file diff --git a/tests/test_mastermap_missing_type.gml.csv b/tests/test_mastermap_missing_type.gml.csv new file mode 100644 index 00000000..04c1efdd --- /dev/null +++ b/tests/test_mastermap_missing_type.gml.csv @@ -0,0 +1,2 @@ +WKT,fid,descriptiveGroup +"POLYGON ((517896.1 186250.8,517891.7 186251.6,517891.1 186248.7,517890.75 186246.7,517890.65 186246.35,517890.45 186245.95,517890.25 186245.8,517889.95 186245.75,517889.65 186245.75,517878.3 186247.9,517874.61 186248.55,517872.9 186239.5,517873.4 186239.7,517873.95 186239.8,517874.25 186239.75,517874.65 186239.7,517875.05 186239.6,517878.35 186238.95,517889.1 186236.85,517892.769 186236.213,517903.2 186234.4,517919.55 186231.4,517932.25 186229.1,517942.1 186227.25,517954.65 186225.05,517968.75 186222.45,517985.25 186219.5,518000.0 186216.65,518021.7 186212.7,518026.7 186211.75,518029.1 186211.3,518029.68 186211.173,518033.65 186210.3,518046.1 186207.65,518058.45 186204.95,518063.3 186203.6,518068.1 186202.25,518068.9 186202.05,518079.6 186198.95,518081.4 186198.3,518083.2 186197.55,518084.95 186196.8,518086.7 186196.0,518088.45 186195.25,518097.85 186191.05,518099.15 186190.45,518108.3 186186.2,518108.375 186186.175,518108.45 186186.15,518108.477 186186.132,518114.5 186183.6,518114.65 186183.55,518114.85 186183.45,518115.05 186183.4,518115.25 186183.3,518115.35 186183.2,518115.45 186183.15,518141.85 186171.55,518142.0 186171.5,518142.15 186171.4,518142.45 186171.3,518142.6 186171.2,518142.7 186171.1,518142.8 186171.05,518142.9 186170.95,518143.05 186170.85,518143.15 186170.75,518143.25 186170.6,518143.4 186170.5,518143.5 186170.4,51814 \ No newline at end of file