get the node config types right

This commit is contained in:
Jean-Paul Calderone 2023-07-21 08:19:27 -04:00
parent 02a696d73b
commit 2d688df299

View File

@ -57,8 +57,8 @@ class MergeConfigTests(unittest.TestCase):
If there are any keys in the ``node_config`` of the left and right If there are any keys in the ``node_config`` of the left and right
parameters that are shared then ``ValueError`` is raised. parameters that are shared then ``ValueError`` is raised.
""" """
left = ListenerConfig([], [], {"foo": "bar"}) left = ListenerConfig([], [], {"foo": [("b", "ar")]})
right = ListenerConfig([], [], {"foo": "baz"}) right = ListenerConfig([], [], {"foo": [("ba", "z")]})
self.assertRaises(ValueError, lambda: create_node.merge_config(left, right)) self.assertRaises(ValueError, lambda: create_node.merge_config(left, right))
def test_merge(self) -> None: def test_merge(self) -> None:
@ -67,14 +67,22 @@ class MergeConfigTests(unittest.TestCase):
all of the ports, locations, and node config from each of the two all of the ports, locations, and node config from each of the two
``ListenerConfig`` values given. ``ListenerConfig`` values given.
""" """
left = ListenerConfig(["left-port"], ["left-location"], {"left": "foo"}) left = ListenerConfig(
right = ListenerConfig(["right-port"], ["right-location"], {"right": "bar"}) ["left-port"],
["left-location"],
{"left": [("f", "oo")]},
)
right = ListenerConfig(
["right-port"],
["right-location"],
{"right": [("ba", "r")]},
)
result = create_node.merge_config(left, right) result = create_node.merge_config(left, right)
self.assertEqual( self.assertEqual(
ListenerConfig( ListenerConfig(
["left-port", "right-port"], ["left-port", "right-port"],
["left-location", "right-location"], ["left-location", "right-location"],
{"left": "foo", "right": "bar"}, {"left": [("f", "oo")], "right": [("ba", "r")]},
), ),
result, result,
) )