Skip to content

Various small fixes - #2876

Merged
VeckoTheGecko merged 9 commits into
Parcels-code:mainfrom
VeckoTheGecko:no-comment
Sep 2, 2026
Merged

Various small fixes#2876
VeckoTheGecko merged 9 commits into
Parcels-code:mainfrom
VeckoTheGecko:no-comment

Conversation

@VeckoTheGecko

Copy link
Copy Markdown
Contributor

Description

Changes:

  • Removal of many outdated TODO comments
  • Incorporating tests-v3/test_reprs.py into the main test suite, and deleting tests-v3
  • Small fixes to the reprs

See comments on individual commits for more info

Checklist

  • Closes None
  • Tests added
  • This PR targets the correct branch (main for normal development, v3-support for v3 support)

AI Disclosure

None used


def __repr__(self):
return f"Field(name={self.name}, model={self.model})"
return f"Field(name={self.name!r}, model={self.model})"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensures quotes. i.e., Field(name='U', ... instead of Field(name=U

Comment thread src/parcels/_repr_utils.py
Comment thread src/parcels/_datasets/structured/generated.py
outputdt : {pfile.outputdt!r}
metadata :
{_format_list_items_multiline(pfile.metadata, level=2, with_brackets=False)}
metadata : {_format_list_items_multiline(pfile.metadata, level=2, with_brackets=False)}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting fix

Comment thread pixi.toml
Comment on lines +86 to +87
[feature.test.pypi-dependencies]
re-assert = "*"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes it very easy to test strings against regexes in Pytest.

https://github.com/asottile/re-assert

with

 def test_field_repr(fieldset):
-    Matches(r"Field\(name=.*, model=.*\)").assert_matches(repr(fieldset.U))
+    Matches(r"Field\(field_name=.*, model=.*\)").assert_matches(repr(fieldset.U))
 
 
 def test_vectorfield_repr(fieldset):

it gives failure of

E       AssertionError:  regex failed to match at:
E       
E       > Field(name='U', model=<parcels._core.model.StructuredModelData object at 0x333847110>)
E               ^

.pixi/envs/default/lib/python3.14/site-packages/re_assert.py:63: AssertionError

As opposed to a generic uninformative "regex failed to match" error that we'd get from the re library directly

@erikvansebille erikvansebille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@VeckoTheGecko
VeckoTheGecko merged commit d69e632 into Parcels-code:main Sep 2, 2026
22 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Parcels development Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants