def test_no_overlap(self): # Test scenario where there is new and old data, but no overlap. prev = [ { "id": 1, "start": 0, "end": 10 }, ] incoming = [ { "id": 2, "start": 10, "end": 20 }, ] expected = [ { "id": 1, "start": 0, "end": 10 }, { "id": 2, "start": 10, "end": 20 }, ] stacker = StackWells() new = stacker._merge_series(prev, incoming) self.assertEqual(new, expected)
def test_intersection(self): # Test scenario where there is intersection prev = [ { "id": 1, "start": 0, "end": 10 }, { "id": 3, "start": 10, "end": 20 }, ] incoming = [ { "id": 2, "start": 5, "end": 15 }, ] expected = [ { "id": 2, "start": 5, "end": 15 }, ] stacker = StackWells() new = stacker._merge_series(prev, incoming) self.assertEqual(new, expected)
def test_new_data(self): # Test scenario where there is only new data. prev = [] incoming = [{ "id": 1, "from_": 0, "to": 10 }, { "id": 2, "from_": 10, "to": 20 }] expected = incoming stacker = StackWells() new = stacker._merge_series(prev, incoming) self.assertEqual(new, expected)