Skip to content

Commit

Permalink
restriction_welder() KeyError test
Browse files Browse the repository at this point in the history
  • Loading branch information
jGaboardi committed Dec 6, 2020
1 parent e078ff0 commit 4b455ba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 0 additions & 2 deletions tigernet/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ def testing_data(f, to_crs="epsg:2779", bbox="general", direc="test_data"):
bbox = (-84.279, 30.480, -84.245, 30.505)
elif bbox == "discard":
bbox = (-84.2525, 30.4412, -84.2472, 30.4528)
elif bbox == "bad_ring":
pass
else:
msg = "'bbox' value of '%s' not supported." % bbox
raise ValueError(msg)
Expand Down
21 changes: 21 additions & 0 deletions tigernet/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@

from .. import utils

import copy
import numpy
import operator
import pandas
import unittest
from shapely.geometry import MultiLineString

from .network_objects import network_lattice_1x1_no_args


class TestUtilsDropGeoms(unittest.TestCase):
def test__drop_geoms(self):
Expand Down Expand Up @@ -71,5 +74,23 @@ def test_record_filter_sval(self):
numpy.testing.assert_array_equal(observed_values, known_values)


class TestUtilRsestrictionWelder(unittest.TestCase):
def setUp(self):
pass

def test_restriction_welder_key_error_synth(self):
known_return = None
_net = copy.deepcopy(network_lattice_1x1_no_args)
ATTR1, ATTR2, SPLIT_GRP, SKIP_RESTR = "MTFCC", "TLID", "FULLNAME", True
INTRST, RAMP, SERV_DR = "S1100", "S1630", "S1640"
SPLIT_BY = [RAMP, SERV_DR]
_net.attr1, _net.attr2, _net.skip_restr = ATTR1, ATTR2, SKIP_RESTR
_net.mtfcc_split, _net.mtfcc_intrst = INTRST, INTRST
_net.mtfcc_split_grp, _net.mtfcc_ramp = SPLIT_GRP, RAMP
_net.mtfcc_split_by, _net.mtfcc_serv = SPLIT_BY, SERV_DR
observed_return = utils.restriction_welder(_net)
self.assertEqual(observed_return, known_return)


if __name__ == "__main__":
unittest.main()

0 comments on commit 4b455ba

Please sign in to comment.