Skip to content

Add additional unit tests#226

Merged
Sam Clarke-Green (t00sa) merged 30 commits intoMetOffice:mainfrom
r-sharp:add-additional-unit-tests
Apr 30, 2026
Merged

Add additional unit tests#226
Sam Clarke-Green (t00sa) merged 30 commits intoMetOffice:mainfrom
r-sharp:add-additional-unit-tests

Conversation

@r-sharp
Copy link
Copy Markdown
Contributor

@r-sharp R Sharp (r-sharp) commented Apr 27, 2026

PR Summary

Sci/Tech Reviewer: James Bruten (@james-bruten-mo)
Code Reviewer: Sam Clarke-Green (@t00sa)

Introduce the "example fortran code" from the UMDP3 document for use in the unit testsing of the style checker rules. The checks should 'pass' this code, but there is the option to midify it on the fly so tests can find failures in something that looks a bit more like a Fortran file than 4 text strings in a list. It will alos hopefully allow the easier creation of more complex unit tests in a way that looks familiar to the 'human' in the chain - as hopefuly evidenced by the unit tests for "r3_4_2_no_full_uppercase_variable_names" which now performs line concattenation on declaration statements to better test all the variable names.

Whilst modifying the conformance checks to make clearer what they relate back to in the docs, I'm moving them to a new file (possibly multiple files) and updating the unit tests to make use of the example fortran code file.

The aim being that the old file of checks, with it's Class and the dispatch tables files will be emptied out as things move over and evnetually removed entirely.

Code Quality Checklist

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid understanding and enhance the readability of the code
  • My changes generate no new warnings
  • All automated checks in the CI pipeline have completed successfully

Testing

  • This change has been tested appropriately (please describe)

All the unit tests introduced pass

Security Considerations

  • I have reviewed my changes for potential security issues
  • Sensitive data is properly handled (if applicable)
  • Authentication and authorisation are properly implemented (if applicable)

AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance of Generative AI tool name (e.g., Met Office Github Copilot Enterprise, Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the Simulation Systems AI policy (including attribution labels)

Met Office Github Copilot Enterprise was used for line completion when writing and suggested alterations when propgating a change through the code.

Sci/Tech Review

  • I understand this area of code and the changes being added
  • The proposed changes correspond to the pull request description
  • Documentation is sufficient (do documentation papers need updating)
  • Sufficient testing has been completed

(Please alert the code reviewer via a tag when you have approved the SR)

Code Review

  • All dependencies have been resolved
  • Related Issues have been properly linked and addressed
  • Code quality standards have been met
  • Tests are adequate and have passed
  • Security considerations have been addressed
  • Performance impact is acceptable

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There's a non-required suggestion to consider, but otherwise it seems fine

Comment thread script_umdp3_checker/tests/test_umdp3_rules_S3.py Outdated
Copy link
Copy Markdown
Collaborator

@t00sa Sam Clarke-Green (t00sa) left a comment

Choose a reason for hiding this comment

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

Mostly typos in comments

Comment thread script_umdp3_checker/checker_dispatch_tables.py Outdated
Comment thread script_umdp3_checker/tests/test_umdp3_rules_S3.py Outdated
Comment thread script_umdp3_checker/tests/test_umdp3_rules_S3.py Outdated
Comment thread script_umdp3_checker/tests/test_umdp3_rules_S3.py Outdated
Mostly typos and tidying. All changes suggested by reviewers and very sensible they were too.

Co-authored-by: James Bruten <109733895+james-bruten-mo@users.noreply.github.com>
Co-authored-by: Sam Clarke-Green <74185251+t00sa@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

@r-sharp R Sharp (r-sharp) left a comment

Choose a reason for hiding this comment

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

Applied all suggestions

Copy link
Copy Markdown
Collaborator

@t00sa Sam Clarke-Green (t00sa) left a comment

Choose a reason for hiding this comment

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

Looks good and pytest passes. Approved!

@t00sa Sam Clarke-Green (t00sa) merged commit 515e549 into MetOffice:main Apr 30, 2026
13 checks passed
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.

Fix incorrect detection of Lowercase or CamelCase variable names only

4 participants