Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eschutho committed Jan 30, 2023
1 parent b8d47ca commit ebdc337
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions superset/result_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ def stringify_values(array: NDArray[Any]) -> NDArray[Any]:
for obj in it:
if na_obj := pd.isna(obj):
# pandas <NA> type cannot be converted to string
obj[na_obj] = None
obj[na_obj] = None # type: ignore
else:
try:
# for simple string conversions
# this handles odd character types better
obj[...] = obj.astype(str)
obj[...] = obj.astype(str) # type: ignore
except ValueError:
obj[...] = stringify(obj)
obj[...] = stringify(obj) # type: ignore

return result

Expand Down
8 changes: 4 additions & 4 deletions superset/utils/pandas_postprocessing/boxplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def boxplot(
"""

def quartile1(series: Series) -> float:
return np.nanpercentile(series, 25, interpolation="midpoint")
return np.nanpercentile(series, 25, method="midpoint")

def quartile3(series: Series) -> float:
return np.nanpercentile(series, 75, interpolation="midpoint")
return np.nanpercentile(series, 75, method="midpoint")

if whisker_type == PostProcessingBoxplotWhiskerType.TUKEY:

Expand Down Expand Up @@ -99,8 +99,8 @@ def whisker_low(series: Series) -> float:
return np.nanpercentile(series, low)

else:
whisker_high = np.max
whisker_low = np.min
whisker_high = np.max # type: ignore
whisker_low = np.min # type: ignore

def outliers(series: Series) -> Set[float]:
above = series[series > whisker_high(series)]
Expand Down
2 changes: 1 addition & 1 deletion superset/utils/pandas_postprocessing/flatten.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def flatten(
_columns = []
for series in df.columns.to_flat_index():
_cells = []
for cell in series if is_sequence(series) else [series]:
for cell in series if is_sequence(series) else [series]: # type: ignore
if pd.notnull(cell):
# every cell should be converted to string and escape comma
_cells.append(escape_separator(str(cell)))
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/result_set_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ def test_nested_types(self):
"id": 4,
"dict_arr": '[{"table_name": "unicode_test", "database_id": 1}]',
"num_arr": "[1, 2, 3]",
"map_col": '{"chart_name": "scatter"}',
"map_col": "{'chart_name': 'scatter'}",
},
{
"id": 3,
"dict_arr": '[{"table_name": "birth_names", "database_id": 1}]',
"num_arr": "[4, 5, 6]",
"map_col": '{"chart_name": "plot"}',
"map_col": "{'chart_name': 'plot'}",
},
],
)
Expand Down

0 comments on commit ebdc337

Please sign in to comment.