Skip to content

Commit

Permalink
Add markers in pyproject.toml to fix pytest warning (#653)
Browse files Browse the repository at this point in the history
* Add markers in pyproject.toml.

* Fix some deprecation warnings from the CI.

* Update text.py
  • Loading branch information
tsalo authored Mar 3, 2022
1 parent b2ee236 commit 0c85370
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nimare/annotate/gclda.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def __init__(

# Create docidx column
count_df["docidx"] = count_df["id"].map(docidx_mapper)
count_df = count_df.drop("id", 1)
count_df = count_df.drop(columns=["id"])

# Remove words not found anywhere in the corpus
n_terms = len(count_df.columns) - 1 # number of columns minus one for docidx
Expand Down
10 changes: 9 additions & 1 deletion nimare/annotate/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ def generate_counts(text_df, text_column="abstract", tfidf=True, min_df=50, max_
stop_words=stop_words,
)
weights = vectorizer.fit_transform(text).toarray()
names = vectorizer.get_feature_names()

if hasattr(vectorizer, "get_feature_names_out"):
# scikit-learn >= 1.0.0
names = vectorizer.get_feature_names_out()
else:
# scikit-learn < 1.0.0
# To remove when we drop support for 3.6 and increase minimum sklearn version to 1.0.0.
names = vectorizer.get_feature_names()

names = [str(name) for name in names]
weights_df = pd.DataFrame(weights, columns=names, index=ids)
weights_df.index.name = "id"
Expand Down
2 changes: 1 addition & 1 deletion nimare/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _check_p_values(
for j in range(3)
]

best_chance_p_values = p_map[gtf_idx]
best_chance_p_values = p_map[tuple(gtf_idx)]
assert all(best_chance_p_values < ALPHA) == good_sensitivity

p_array_sig = p_array[sig_idx]
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ exclude = '''

[tool.pytest.ini_options]
markers = [
"performance: mark tests that measure performance (deselect with '-m \"not performance\"')",
"performance_smoke: mark smoke tests that measure performance",
"performance_estimators: mark tests that measure estimator performance",
"performance_correctors: mark tests that measure corrector performance",
]

[tool.isort]
Expand Down

0 comments on commit 0c85370

Please sign in to comment.