Skip to content

Commit

Permalink
Appease linter
Browse files Browse the repository at this point in the history
Signed-off-by: Itay Dafna <[email protected]>
  • Loading branch information
ibdafna committed Aug 30, 2021
1 parent b1a781a commit d1b54fd
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions tests/test_datagrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def mock_get_visible_data():

assert datagrid.selected_cell_values == [2, 5, 3, 6]


def test_dataframe_index_name(dataframe):
# Setting a custom index name
dataframe.index.name = "custom_index"
Expand All @@ -164,7 +165,8 @@ def test_dataframe_index_name(dataframe):

# Checking index name matches DataFrame retrieved from grid
data = grid.get_visible_data()
assert(data.index.name == "custom_index")
assert data.index.name == "custom_index"


def test_user_defined_index_name(dataframe):
# Setting a custom index name
Expand All @@ -176,16 +178,15 @@ def test_user_defined_index_name(dataframe):

# Checking index name matches DataFrame retrieved from grid
index_key = grid.get_dataframe_index(dataframe)
data_obj = grid.generate_data_object(
dataframe, "ipydguuid", index_key
)
data_obj = grid.generate_data_object(dataframe, "ipydguuid", index_key)

# Default and unused keys should not be in schema
assert "key" not in data_obj['schema']['primaryKey']
assert "unused_index" not in data_obj['schema']['primaryKey']
assert "key" not in data_obj["schema"]["primaryKey"]
assert "unused_index" not in data_obj["schema"]["primaryKey"]

# User defined key should be in primary key schema
assert "custom_index" in data_obj['schema']['primaryKey']
assert "custom_index" in data_obj["schema"]["primaryKey"]


def test_named_dataframe_index(dataframe):
# Setting a custom index name
Expand All @@ -197,15 +198,14 @@ def test_named_dataframe_index(dataframe):

# Generate primary key schema object
index_key = grid.get_dataframe_index(dataframe)
data_obj = grid.generate_data_object(
dataframe, "ipydguuid", index_key
)
data_obj = grid.generate_data_object(dataframe, "ipydguuid", index_key)

# Default and unused keys should not be in schema
assert "key" not in data_obj['schema']['primaryKey']
assert "key" not in data_obj["schema"]["primaryKey"]

# User named dataframe index should be in schema
assert "my_used_index" in data_obj['schema']['primaryKey']
assert "my_used_index" in data_obj["schema"]["primaryKey"]


def test_default_dataframe_index(dataframe):
# Setting a custom index name
Expand All @@ -216,9 +216,7 @@ def test_default_dataframe_index(dataframe):

# Generate primary key schema object
index_key = grid.get_dataframe_index(dataframe)
data_obj = grid.generate_data_object(
dataframe, "ipydguuid", index_key
)
data_obj = grid.generate_data_object(dataframe, "ipydguuid", index_key)

# Default and unused keys should not be in schema
assert "key" in data_obj['schema']['primaryKey']
assert "key" in data_obj["schema"]["primaryKey"]

0 comments on commit d1b54fd

Please sign in to comment.