Skip to content

Commit

Permalink
[python] try to fix gh-actions for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
hbaniecki committed Feb 28, 2024
1 parent d7d9d7a commit db2ae5d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
29 changes: 27 additions & 2 deletions python/dalex/test/test_arena_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def setUp(self):

self.X = data.drop(columns='survived')
self.y = data.survived
self.john = pd.DataFrame({'gender': ['male'], 'age': [25], 'class': ['1st'], 'embarked': ['Southampton'], 'fare': [72], 'sibsp': [0], 'parch': 0}, index = ['John'])
self.john = pd.DataFrame({'gender': ['male'], 'age': [25], 'class': ['1st'], 'embarked': ['Southampton'],
'fare': [72], 'sibsp': [0], 'parch': 0}, index = ['John'])

numeric_features = ['age', 'fare', 'sibsp', 'parch']
numeric_transformer = Pipeline(steps=[
Expand Down Expand Up @@ -66,6 +67,11 @@ def test_supported_plots(self):
sorting = lambda x: x.__name__
self.assertEqual(sorted(plots, key=sorting), sorted(self.reference_plots, key=sorting))

try:
arena.stop_server()
except Exception:
pass

def test_server(self):
arena = dx.Arena()
arena.push_model(self.exp)
Expand All @@ -78,7 +84,11 @@ def test_server(self):
arena.stop_server()
except AssertionError as e:
arena.stop_server()
raise e

try:
arena.stop_server()
except Exception:
pass

def test_plots(self):
arena = dx.Arena()
Expand All @@ -91,6 +101,11 @@ def test_plots(self):
count = np.sum([1 for plot in arena.plots_manager.cache if plot.__class__ == p])
self.assertEqual(np.prod(ref_counts), count, msg="Count of " + str(p))

try:
arena.stop_server()
except Exception:
pass

def test_observation_attributes(self):
arena = dx.Arena()
arena.push_model(self.exp)
Expand All @@ -103,6 +118,11 @@ def test_observation_attributes(self):
for attr in attrs:
self.assertTrue(all(attr.get('values')[:-1] == titanic[attr.get('name')]))

try:
arena.stop_server()
except Exception:
pass

def test_variable_attributes(self):
arena = dx.Arena()
arena.push_model(self.exp)
Expand All @@ -119,5 +139,10 @@ def test_variable_attributes(self):
'sibsp': {'type': 'numeric', 'min': 0, 'max': 8, 'levels': [0, 1, 2, 3, 4, 5, 8]}
})

try:
arena.stop_server()
except Exception:
pass

if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion python/dalex/test/test_ceteris_paribus.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def test_plot(self):
fig3 = case1.plot(case2, variables="age", show=False)
fig4 = case2.plot(variables="gender", show=False)
fig5 = case1.plot(case3, size=1, color="gender", facet_ncol=1, show_observations=False,
title="title", horizontal_spacing=0.2, vertical_spacing=0.2,
title="title", horizontal_spacing=0.2, vertical_spacing=0.15,
show=False)
fig6 = case2.plot(variables=["gender"], show=False)
fig7 = case2.plot(variables=["gender", 'class'], show=False)
Expand Down

0 comments on commit db2ae5d

Please sign in to comment.