Skip to content

Commit

Permalink
refactor: avoid a bit of list duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
ManonMarchand committed Jul 11, 2024
1 parent 24c8185 commit 019de17
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 31 deletions.
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,9 @@ ignore = ["ISC001", "ANN101", "D203", "D213", "D100", "D105"]
[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.lint.per-file-ignores]
# D104: Missing docstring in public package
"__init__.py" = ["D104"]

[tool.ruff.format]
docstring-code-format = false
Empty file added src/test/__init__.py
Empty file.
32 changes: 3 additions & 29 deletions src/test/test_aladin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from ipyaladin import Aladin
from ipyaladin.coordinate_parser import parse_coordinate_string

from .test_coordinate_parser import test_is_coordinate_string_values

aladin = Aladin()


Expand All @@ -15,35 +17,7 @@ def mock_sesame(monkeypatch: Callable) -> None:
monkeypatch.setattr(SkyCoord, "from_name", lambda _: SkyCoord(0, 0, unit="deg"))


test_aladin_string_target = [
"M 31",
"sgr a*",
"α Centauri", # noqa RUF001
"* 17 Com",
"1:12:43.2 31:12:43",
"1:12:43.2 +31:12:43",
"1:12:43.2 -31:12:43",
"1 12 43.2 31 12 43",
"1 12 43.2 +31 12 43",
"1 12 43.2 -31 12 43",
"1h12m43.2s 1d12m43s",
"1h12m43.2s +1d12m43s",
"1h12m43.2s -1d12m43s",
"42.67 25.48",
"42.67 +25.48",
"42.67 -25.48",
"0 0",
"J42.67 25.48",
"G42.67 25.48",
"B42.67 25.48",
"J12 30 45 +45 30 15",
"J03 15 20 -10 20 30",
"G120.5 -45.7",
"G90 0",
"B60 30",
"B120 -45",
"Galactic Center",
]
test_aladin_string_target, _ = zip(*test_is_coordinate_string_values)


@pytest.mark.parametrize("target", test_aladin_string_target)
Expand Down
5 changes: 3 additions & 2 deletions src/test/test_coordinate_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
test_is_coordinate_string_values = [
("M 31", False),
("sgr a*", False),
("α Centauri", False), # noqa RUF001
("* 17 Com", False),
("1:12:43.2 31:12:43", True),
("1:12:43.2 +31:12:43", True),
("1:12:43.2 -31:12:43", True),
Expand All @@ -24,11 +26,10 @@
("42.67 +25.48", True),
("42.67 -25.48", True),
("0 0", True),
("J12 30 45 +45 30 15", True),
("J42.67 25.48", True),
("G42.67 25.48", True),
("B42.67 25.48", True),
('17h 45m 40.0409s -29° 00′ 28.118"', True), # noqa RUF001
("17h 45m 40.0409s -29° 00' 28.118\"", True),
("Galactic Center", False),
]

Expand Down

0 comments on commit 019de17

Please sign in to comment.