Skip to content

Commit

Permalink
add another test
Browse files Browse the repository at this point in the history
  • Loading branch information
sc1f committed Nov 26, 2019
1 parent 3380495 commit 98f8da4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion python/perspective/perspective/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def clear_views(self, client_id):
for name in names:
self._views.pop(name)

print("GC {} views in memory".format(count))
logging.warn("GC {} views in memory".format(count))

def _make_message(self, id, result):
'''Return a serializable message for a successful result.'''
Expand Down
1 change: 0 additions & 1 deletion python/perspective/perspective/table/_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def _type_to_format(data_or_schema):
else:
# flatten column/index multiindex
df, _ = deconstruct_pandas(data_or_schema)
print(df, _)
return True, 1, {c: df[c].values for c in df.columns}


Expand Down
19 changes: 19 additions & 0 deletions python/perspective/perspective/tests/table/test_table_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,25 @@ def test_table_infer_bool_str(self):
"b": bool
}

def test_table_bool_infer_str_all_formats_from_schema(self):
bool_data = [
{"a": "True", "b": "False"},
{"a": "t", "b": "f"},
{"a": "true", "b": "false"},
{"a": 1, "b": 0},
{"a": "on", "b": "off"}
]
tbl = Table(bool_data)
assert tbl.schema() == {
"a": bool,
"b": bool
}
assert tbl.size() == 5
assert tbl.view().to_dict() == {
"a": [True, True, True, True, True],
"b": [False, False, False, False, False]
}

def test_table_promote_float(self):
if six.PY2:
data = {"a": [1.5, 2.5, 3.5, 4.5, "abc"]}
Expand Down
8 changes: 4 additions & 4 deletions python/perspective/perspective/tests/table/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_update_columnar_partial(self):

# bool

def test_table_bool_from_schema(self):
def test_update_bool_from_schema(self):
bool_data = [{"a": True, "b": False}, {"a": True, "b": True}]
tbl = Table({
"a": bool,
Expand All @@ -63,7 +63,7 @@ def test_table_bool_from_schema(self):
assert tbl.size() == 2
assert tbl.view().to_records() == bool_data

def test_table_bool_str_from_schema(self):
def test_update_bool_str_from_schema(self):
bool_data = [{"a": "True", "b": "False"}, {"a": "True", "b": "True"}]
tbl = Table({
"a": bool,
Expand All @@ -75,7 +75,7 @@ def test_table_bool_str_from_schema(self):
{"a": True, "b": False},
{"a": True, "b": True}]

def test_table_bool_str_all_formats_from_schema(self):
def test_update_bool_str_all_formats_from_schema(self):
bool_data = [
{"a": "True", "b": "False"},
{"a": "t", "b": "f"},
Expand All @@ -94,7 +94,7 @@ def test_table_bool_str_all_formats_from_schema(self):
"b": [False, False, False, False, False]
}

def test_table_bool_int_from_schema(self):
def test_update_bool_int_from_schema(self):
bool_data = [{"a": 1, "b": 0}, {"a": 1, "b": 0}]
tbl = Table({
"a": bool,
Expand Down
1 change: 0 additions & 1 deletion python/perspective/perspective/widget/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ def __init__(self,
# Parse the dataset we pass in - if it's Pandas, preserve pivots
if isinstance(table_or_data, pandas.DataFrame) or isinstance(table_or_data, pandas.Series):
data, pivots = deconstruct_pandas(table_or_data)
print(data, pivots)
table_or_data = data

if pivots.get("row_pivots", None):
Expand Down

0 comments on commit 98f8da4

Please sign in to comment.