Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINT] transfer tests from pybids #8

Merged
merged 9 commits into from
Aug 15, 2024
Merged

Conversation

Remi-Gau
Copy link
Contributor

@Remi-Gau Remi-Gau commented Aug 14, 2024

  • transfer tests cases that were run in pybids
  • split between valid and invalid tests

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.19%. Comparing base (9acd81f) to head (bb5f82d).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
+ Coverage   85.90%   93.19%   +7.28%     
==========================================
  Files           3        3              
  Lines         149      191      +42     
  Branches       43       55      +12     
==========================================
+ Hits          128      178      +50     
+ Misses          9        5       -4     
+ Partials       12        8       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@effigies
Copy link
Contributor

I'm surprised this is passing.

('/sub-01/anat/sub-01_T1w.nii.gz', False),
('/RADME', False), # typo
('/CANGES', False), # typo
],
)
def test_top_level(validator, fname, matches):
Copy link
Contributor

Choose a reason for hiding this comment

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

In retrospect, I don't like parametrizing on matches. I would rather just split it into two functions, e.g.,

@pytest.mark.parametrize('fname', valid_list)
def test_is_top_level(validator, fname):
    assert validator.is_top_level(fname)

@pytest.mark.parametrize('fname', invalid_list)
def test_is_not_top_level(validator, fname):
    assert not validator.is_top_level(fname)

If you've got the energy, would you do this? If not, I'll just create an issue, and might sooner or later get around to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you want to apply this to all tests?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

@effigies
Copy link
Contributor

@Remi-Gau I assume you're looking through the failing entries, but I can if you'd rather.

@Remi-Gau
Copy link
Contributor Author

yeah I will have a look

@effigies
Copy link
Contributor

I suspect that what's happening is that more targeted regexes were expected, and valid BIDS files were being passed to see whether they triggered only the right ones. Checking is_bids() would be expected to pass.

@Remi-Gau
Copy link
Contributor Author

OK from my understanding it seems that all the failures are due to the fact that the validaton in pybids used to include methods methods such as is_anat which were stricter than the simple is_bids here.

I would suggest just removing the test case that fail unless we have any intention of adding those methods back at some point (and even then adding those tests would be easy, so I am very much in favor of removing those test cases).

@Remi-Gau
Copy link
Contributor Author

I suspect that what's happening is that more targeted regexes were expected, and valid BIDS files were being passed to see whether they triggered only the right ones. Checking is_bids() would be expected to pass.

hahaha look at us independently coming to the same conclusion #reproducibility

@effigies
Copy link
Contributor

effigies commented Aug 15, 2024

Yeah, no we definitely aren't going to make more and more precise groupings of regexes, so let's get rid of these.

I see the regexes as a stopgap until we implement parsing that can tell people what they got wrong, not just "is it BIDS?". Possibly we'll keep them around for fast filtering of non-BIDS files from a layout, as in pybids.

@Remi-Gau
Copy link
Contributor Author

@effigies
Copy link
Contributor

Bad regex generation in earlier bidsschematools. Bump to 0.11 in pyproject.toml and tox.ini.

@effigies
Copy link
Contributor

It's pleasing that the min check exposed exactly the overlookable edge case it was meant to. I forgot about it, myself.

@Remi-Gau
Copy link
Contributor Author

nothing else to do on my side for this one

@effigies effigies merged commit 3624fbf into bids-standard:main Aug 15, 2024
31 checks passed
@effigies
Copy link
Contributor

Thanks!

@Remi-Gau Remi-Gau deleted the tests branch August 15, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants