Skip to content

Commit

Permalink
fixed style
Browse files Browse the repository at this point in the history
  • Loading branch information
juanbc committed Feb 8, 2024
1 parent 3bf9f32 commit 7d4ae53
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion skcriteria/preprocessing/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ def cenit_distance(matrix, objectives):
)
@doc_inherit(scalers.CenitDistanceMatrixScaler, warn_class=False)
class CenitDistance(scalers.CenitDistanceMatrixScaler):
...
pass
2 changes: 1 addition & 1 deletion skcriteria/preprocessing/weighters.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,4 @@ def _weight_matrix(self, matrix, objectives, **kwargs):
)
@doc_inherit(CRITIC, warn_class=False)
class Critic(CRITIC):
...
pass
5 changes: 2 additions & 3 deletions tests/cmp/ranks_rev/test_rank_inv_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

def test_RankInvariantChecker_decision_maker_no_evaluate_method():
class NoEvaluateMethod:
...
pass

dmaker = NoEvaluateMethod()
with pytest.raises(TypeError):
Expand All @@ -53,8 +53,7 @@ class EvaluateNoCallable:

def test_RankInvariantChecker_invalid_last_diff_strategy():
class FakeDM:
def evaluate(self):
...
def evaluate(self): ...

dmaker = FakeDM()
with pytest.raises(TypeError):
Expand Down
32 changes: 20 additions & 12 deletions tests/cmp/test_ranks_cmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,16 @@ def test_RanksComparator_cov(untied):

expected = pd.DataFrame.from_dict(
{
"test_1": {"test_1": 0.5, "test_2": 0.5}
if untied
else {"test_1": 0.0, "test_2": 0.0},
"test_2": {"test_1": 0.5, "test_2": 0.5}
if untied
else {"test_1": 0.0, "test_2": 0.0},
"test_1": (
{"test_1": 0.5, "test_2": 0.5}
if untied
else {"test_1": 0.0, "test_2": 0.0}
),
"test_2": (
{"test_1": 0.5, "test_2": 0.5}
if untied
else {"test_1": 0.0, "test_2": 0.0}
),
},
)

Expand All @@ -181,12 +185,16 @@ def test_RanksComparator_corr(untied):

expected = pd.DataFrame.from_dict(
{
"test_1": {"test_1": 1.0, "test_2": 1.0}
if untied
else {"test_1": np.nan, "test_2": np.nan},
"test_2": {"test_1": 1.0, "test_2": 1.0}
if untied
else {"test_1": np.nan, "test_2": np.nan},
"test_1": (
{"test_1": 1.0, "test_2": 1.0}
if untied
else {"test_1": np.nan, "test_2": np.nan}
),
"test_2": (
{"test_1": 1.0, "test_2": 1.0}
if untied
else {"test_1": np.nan, "test_2": np.nan}
),
},
)

Expand Down
11 changes: 6 additions & 5 deletions tests/core/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ def test_DecisionMatrixStatsAccessor_df_whitelist_by_kind(

result_call = stats(kind=kind)

cmp = (
lambda r, e: r.equals(e)
if isinstance(result_call, (pd.DataFrame, pd.Series))
else np.equal
)
def cmp(r, e):
return (
r.equals(e)
if isinstance(result_call, (pd.DataFrame, pd.Series))
else np.equal
)

result_method = getattr(stats, kind)()

Expand Down
12 changes: 4 additions & 8 deletions tests/preprocessing/test_preprocessing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@ class Foo(SKCMatrixAndWeightTransformerABC):

def test_SKCMatrixAndWeightTransformerABC_bad_normalize_for():
class Foo(SKCMatrixAndWeightTransformerABC):
def _transform_matrix(self, matrix):
...
def _transform_matrix(self, matrix): ...

def _transform_weights(self, weights):
...
def _transform_weights(self, weights): ...

with pytest.raises(ValueError):
Foo("mtx")
Expand Down Expand Up @@ -122,11 +120,9 @@ def _transform_weights(self, weights):

def test_SKCMatrixAndWeightTransformerABC_target():
class Foo(SKCMatrixAndWeightTransformerABC):
def _transform_matrix(self, matrix):
...
def _transform_matrix(self, matrix): ...

def _transform_weights(self, weights):
...
def _transform_weights(self, weights): ...

foo = Foo("matrix")
assert foo.target == Foo._TARGET_MATRIX
Expand Down
9 changes: 3 additions & 6 deletions tests/utils/test_doctools.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,15 @@ def test_doc_inherit():

doc = "".join(random.choice(chars, 1000))

def func_a():
...
def func_a(): ...

func_a.__doc__ = doc

@doctools.doc_inherit(func_a)
def func_b():
...
def func_b(): ...

@doctools.doc_inherit(doc)
def func_c():
...
def func_c(): ...

assert doc == func_a.__doc__ == func_b.__doc__ == func_c.__doc__

Expand Down

0 comments on commit 7d4ae53

Please sign in to comment.