def test_instrument_diff(self): left = self.dataset_left["station"]["instruments"]["another"] right = self.dataset_right["station"]["instruments"]["another"] diff = diff_param_values(left, right) self.assertEqual(diff.changed, {}) self.assertEqual(diff.left_only, {}) self.assertEqual(diff.right_only, {"pi": 3.1})
def test_instrument_diff(): left = DATASETLEFT["station"]["instruments"]["another"] right = DATASETRIGHT["station"]["instruments"]["another"] diff = diff_param_values(left, right) assert diff.changed == {} assert diff.left_only == {} assert diff.right_only == { "pi": 3.1 }
def test_dataset_diff(self): diff = diff_param_values(self.dataset_left, self.dataset_right) self.assertEqual( diff.changed, { "apple": ("orange", "grape"), ("correct", "horse"): ("battery", "staple"), }) self.assertEqual(diff.left_only, {("correct", "left"): "only"}) self.assertEqual(diff.right_only, { ("correct", "right"): "only", ("another", "pi"): 3.1, })
def test_diff(self): left = { "station": { "parameters": { "apple": { "value": "orange" } }, "instruments": { "correct": { "parameters": { "horse": { "value": "battery" }, "left": { "value": "only" } } } } } } right = { "station": { "parameters": { "apple": { "value": "grape" } }, "instruments": { "correct": { "parameters": { "horse": { "value": "staple" }, "right": { "value": "only" } } } } } } diff = diff_param_values(left, right) self.assertEqual( diff.changed, { "apple": ("orange", "grape"), ("correct", "horse"): ("battery", "staple") }) self.assertEqual(diff.left_only, {("correct", "left"): "only"}) self.assertEqual(diff.right_only, {("correct", "right"): "only"})
def test_dataset_diff(): diff = diff_param_values(DATASETLEFT, DATASETRIGHT) assert diff.changed == { "apple": ("orange", "grape"), ("correct", "horse"): ("battery", "staple"), } assert diff.left_only == { ("correct", "left"): "only" } assert diff.right_only == { ("correct", "right"): "only", ("another", "pi"): 3.1, }
def test_station_diff(): left = DATASETLEFT["station"] right = DATASETRIGHT["station"] diff = diff_param_values(left, right) assert diff.changed == { "apple": ("orange", "grape"), ("correct", "horse"): ("battery", "staple") } assert diff.left_only == { ("correct", "left"): "only" } assert diff.right_only == { ("correct", "right"): "only", ("another", "pi"): 3.1, }