def test_cell_change_when_column_data_source(): # Given value = ColumnDataSource(pd.DataFrame({"x": [1, 2], "y": ["a", "b"]})) tabulator = Tabulator(value=value) # When tabulator._cell_change = {"c": "x", "i": 1, "v": 3} # Then we assume the columndatasource has been update on the js side # and therefore don't update on the python side assert tabulator.value.to_df().loc[1, "x"] == 2
def test_cell_change_when_dataframe(): # Given value = pd.DataFrame({"x": [1, 2], "y": ["a", "b"]}) tabulator = Tabulator(value=value) original_data = tabulator._source.data # When tabulator._cell_change = {"c": "x", "i": 1, "v": 3} # Then assert tabulator.value.loc[1, "x"] == 3 # And the tabulator._source.data shall not have been updated # We currently use the _pause_cds_updates parameter to avoid reupdating the _source.data assert tabulator._source.data is original_data