Skip to content

Commit

Permalink
Merge pull request #74 from csiro-coasts/negative-bounds-argument
Browse files Browse the repository at this point in the history
Fix an issue with negative coordinates in `bounds_argument`
  • Loading branch information
mx-moth authored Apr 26, 2023
2 parents e7c90b1 + f6dba2a commit a41a375
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/releases/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Next release (in development)
=============================

* ...
* Fix an issue with negative coordinates in :func:`~emsarray.cli.utils.bounds_argument` (:pr:`74`).
2 changes: 1 addition & 1 deletion src/emsarray/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def set_verbosity(level: int) -> None:


NUMBER = r'\d+(?:_\d+)*'
DECIMAL = rf'({NUMBER}|{NUMBER}\.|\.{NUMBER}|{NUMBER}\.{NUMBER})'
DECIMAL = rf'(-?(?:{NUMBER}|{NUMBER}\.|\.{NUMBER}|{NUMBER}\.{NUMBER}))'
bounds_re = re.compile(r'\s*,\s*'.join([DECIMAL] * 4))


Expand Down
4 changes: 2 additions & 2 deletions tests/cli/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def test_add_verbosity_group(args: List[str], expected: int) -> None:


def test_bounds_argument() -> None:
expected = box(1.5, .2, 3., 4)
actual = utils.bounds_argument("1.5 , .2 , 3.,4")
expected = box(1.5, -.2, 3., 4)
actual = utils.bounds_argument("1.5 , -.2 , 3.,4")

assert actual.equals(expected)

Expand Down

0 comments on commit a41a375

Please sign in to comment.