Example #1
0
def test_selection_dataframe(data_records, dataframe):
    # Given
    tabulator = Tabulator(value=dataframe)
    # When
    tabulator.selection = [0, 1, 2]
    actual = tabulator.selected_values
    # Then
    expected = pd.DataFrame(data=data_records[0:3])
    pd.testing.assert_frame_equal(actual, expected)
Example #2
0
def test_selection_column_data_source(data_records, column_data_source):
    # Given
    tabulator = Tabulator(value=column_data_source)
    # When
    tabulator.selection = [0, 1, 2]
    actual = tabulator.selected_values
    # Then
    # I could not find a more direct way to test this.
    expected_as_df = pd.DataFrame(data=data_records[0:3])
    pd.testing.assert_frame_equal(actual.to_df().drop(columns="index"),
                                  expected_as_df)