def test_diff_with_same_grid(): left = Grid(columns={"a": {}, "b": {}}) left.append({"a": 1, "b": 2}) left.append({"a": 3, "b": 4}) diff = grid_diff(left, left) assert len(diff) == 0 assert grid_merge(left.copy(), diff) == left
def test_merge_timeseries_with_diff_ts_same_values(): destination = Grid(columns=["ts", "value"]) destination.append({ "ts": datetime(2020, 1, 1, 0, 0, 2, 0, tzinfo=pytz.UTC), "value": 100 }) source = destination.copy() result_grid = merge_timeseries(source, destination) assert source == result_grid
def test_diff_with_no_column(): left = Grid(columns={"a": {}, "b": {}}) left.append({"a": 1, "b": 2}) left.append({"a": 3, "b": 4}) left.append({"a": 1, "b": 2}) left.append({"a": 1, "b": 2}) right = Grid() diff = grid_diff(left, right) assert len(diff) == 4 assert grid_merge(left.copy(), diff) == right