Skip to content

Commit

Permalink
Merge pull request #39 from astronomy-commons/delucchi/pylint
Browse files Browse the repository at this point in the history
Address pylint issues under /tests/
  • Loading branch information
delucchi-cmu authored Oct 12, 2023
2 parents b856e41 + 1b80e62 commit 5f8746d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Analyze code with linter

run: |
pylint -rn -sn --recursive=y ./src --rcfile=./src/.pylintrc
pylint -rn -sn --recursive=y ./tests --rcfile=./tests/.pylintrc
1 change: 1 addition & 0 deletions tests/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ disable=raw-checker-failed,
redefined-outer-name,
protected-access,
missing-module-docstring,
missing-class-docstring,
unnecessary-pass,

# Enable the message, report, category or checker with the given id(s). You can
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
SMALL_SKY_ORDER1_DIR_NAME = "small_sky_order1"
XMATCH_CORRECT_FILE = "xmatch_correct.csv"
XMATCH_CORRECT_005_FILE = "xmatch_correct_0_005.csv"
XMATCH_CORRECT_3n_2t_NO_MARGIN_FILE = "xmatch_correct_3n_2t_no_margin.csv"
XMATCH_CORRECT_3N_2T_NO_MARGIN_FILE = "xmatch_correct_3n_2t_no_margin.csv"
XMATCH_MOCK_FILE = "xmatch_mock.csv"
TEST_DIR = os.path.dirname(__file__)

Expand Down Expand Up @@ -80,7 +80,7 @@ def xmatch_correct_005(small_sky_xmatch_dir):

@pytest.fixture
def xmatch_correct_3n_2t_no_margin(small_sky_xmatch_dir):
return pd.read_csv(os.path.join(small_sky_xmatch_dir, XMATCH_CORRECT_3n_2t_NO_MARGIN_FILE))
return pd.read_csv(os.path.join(small_sky_xmatch_dir, XMATCH_CORRECT_3N_2T_NO_MARGIN_FILE))


@pytest.fixture
Expand Down
4 changes: 2 additions & 2 deletions tests/lsdb/catalog/test_cone_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ def test_cone_search_filters_correct_points(small_sky_order1_catalog):
ra = 0
dec = -80
radius = 20
center_coord = SkyCoord(ra, dec, unit='deg')
center_coord = SkyCoord(ra, dec, unit="deg")
cone_search_catalog = small_sky_order1_catalog.cone_search(ra, dec, radius).compute()
print(len(cone_search_catalog))
for _, row in small_sky_order1_catalog.compute().iterrows():
row_ra = row[small_sky_order1_catalog.hc_structure.catalog_info.ra_column]
row_dec = row[small_sky_order1_catalog.hc_structure.catalog_info.dec_column]
sep = SkyCoord(row_ra, row_dec, unit='deg').separation(center_coord)
sep = SkyCoord(row_ra, row_dec, unit="deg").separation(center_coord)
if sep.degree <= radius:
assert len(cone_search_catalog.loc[cone_search_catalog["id"] == row["id"]]) == 1
else:
Expand Down
4 changes: 1 addition & 3 deletions tests/lsdb/catalog/test_crossmatch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from typing import Tuple

import pandas as pd
import hipscat as hc
import pytest

from lsdb.core.crossmatch.abstract_crossmatch_algorithm import AbstractCrossmatchAlgorithm
Expand Down Expand Up @@ -59,6 +56,7 @@ def test_wrong_suffixes(small_sky_catalog, small_sky_xmatch_catalog):
small_sky_catalog.crossmatch(small_sky_xmatch_catalog, suffixes=("wrong",))


# pylint: disable=too-few-public-methods
class MockCrossmatchAlgorithm(AbstractCrossmatchAlgorithm):
def crossmatch(self, mock_results: pd.DataFrame = None):
left_reset = self.left.reset_index(drop=True)
Expand Down

0 comments on commit 5f8746d

Please sign in to comment.