Skip to content

(Closes #225) Add .get_name() to Function_Stmt and Entity_Decl#323

Merged
arporter merged 6 commits intostfc:masterfrom
PlasmaFAIR:add-get-name
Apr 7, 2022
Merged

(Closes #225) Add .get_name() to Function_Stmt and Entity_Decl#323
arporter merged 6 commits intostfc:masterfrom
PlasmaFAIR:add-get-name

Conversation

@ZedThree
Copy link

@ZedThree ZedThree commented Apr 4, 2022

Fixes #225

Probably I've not added the tests to the best location, so I'm happy to move them if there's somewhere better

@codecov
Copy link

codecov bot commented Apr 4, 2022

Codecov Report

Merging #323 (e2db3f8) into master (58f903d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #323   +/-   ##
=======================================
  Coverage   91.33%   91.33%           
=======================================
  Files          36       36           
  Lines       13159    13163    +4     
=======================================
+ Hits        12019    12023    +4     
  Misses       1140     1140           
Impacted Files Coverage Δ
src/fparser/two/Fortran2003.py 93.51% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58f903d...e2db3f8. Read the comment docs.

@arporter
Copy link
Member

arporter commented Apr 4, 2022

Many thanks for this enhancement. Note that one of the conditions of code review (https://github.com/stfc/fparser/wiki/CodeReview) is that there is full test coverage of any modified code. The tests themselves need to be in files named for the classes/rules to which they apply. Therefore, the one for Function_Stmt is good but the other needs to be moved. If there are is no such file yet (and for many classes there aren't) then please copy one of the existing ones and add your tests. Please also search the massive fortran2003_test.py and move any tests of that class into the new file too.

@ZedThree
Copy link
Author

ZedThree commented Apr 5, 2022

Done! I have also added tests for the get_name methods on Program_Stmt and Subroutine_Stmt

@ZedThree
Copy link
Author

ZedThree commented Apr 5, 2022

I notice that some classes use property for some of the items, e.g. label of Do_Label_Stmt. That would probably be a nicer interface for name here too.

Probably something for a different PR, but is there any interest in converting all the accessor methods for the various items elements to properties instead? e.g. get_name() -> name?

@arporter arporter changed the title Add .get_name() to Function_Stmt and Entity_Decl (Closes #225) Add .get_name() to Function_Stmt and Entity_Decl Apr 7, 2022
Copy link
Member

@arporter arporter left a comment

Choose a reason for hiding this comment

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

Great work, thanks for doing all of that.
You'll see I've requested (brief) docstrings for the tests and they also need the f2003_parser fixture setup. Currently we seem to do that on a test-by-test basis so I'm happy for you to copy that although ultimately we really need to add an autouse for the files where it makes sense.
I've also updated the PR title so that #225 will get closed when this is merged.

@arporter arporter added reviewed with actions PR has been reviewed and is back with developer and removed under review labels Apr 7, 2022
@ZedThree
Copy link
Author

ZedThree commented Apr 7, 2022

All done! @arporter ready for review

I've added autouse=True to the f2003_create and f2008_create fixtures, so that all tests in the f2003/f2008 subdirectories use them automatically.

I've also updated the PR title so that #225 will get closed when this is merged.

Just to note that the Fixes #225 in the PR comment body also does this 🙂


:returns: the program name as a `Name` class
:rtype: `Name`
:returns: the program name as a :py:class:`Name` class
Copy link
Member

Choose a reason for hiding this comment

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

There's no need to duplicate the type specification in the :returns: field but it's not a biggie.

@arporter arporter added under review and removed reviewed with actions PR has been reviewed and is back with developer labels Apr 7, 2022
Copy link
Member

@arporter arporter left a comment

Choose a reason for hiding this comment

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

All requested changes have been made (thanks).
Tests now pass in isolation.
No documentation update required.
Issue number not mentioned anywhere.
I will proceed to merge this.

arporter added a commit that referenced this pull request Apr 7, 2022
@arporter arporter merged commit e2db3f8 into stfc:master Apr 7, 2022
ZedThree added a commit that referenced this pull request May 10, 2022
* master:
  pr #322. Updated changelog ready for merge to master.
  #322 try quoting python versions in GHA yml
  #322 updates for review
  #323 update changelog
  Use Sphinx roles to some docstrings
  Add some test docstrings
  Move entity decl test under f2003 directory
  Auto-use parser creation fixtures
  Add more tests for `get_name` methods
  Add `.get_name()` to `Function_Stmt` and `Entity_Decl`
ZedThree added a commit that referenced this pull request May 10, 2022
* master:
  pr #322. Updated changelog ready for merge to master.
  #322 try quoting python versions in GHA yml
  #322 updates for review
  #323 update changelog
  Use Sphinx roles to some docstrings
  Add some test docstrings
  Move entity decl test under f2003 directory
  Auto-use parser creation fixtures
  Add more tests for `get_name` methods
  Add `.get_name()` to `Function_Stmt` and `Entity_Decl`
ZedThree added a commit that referenced this pull request May 11, 2022
* master:
  pr #322. Updated changelog ready for merge to master.
  #322 try quoting python versions in GHA yml
  #322 updates for review
  #323 update changelog
  Use Sphinx roles to some docstrings
  Add some test docstrings
  Move entity decl test under f2003 directory
  Auto-use parser creation fixtures
  Add more tests for `get_name` methods
  Add `.get_name()` to `Function_Stmt` and `Entity_Decl`
  #322 rm py2-specific code from Fortran2003.py
  #322 fix-up coverage and tidy some pylint issues
  #322 fix links and formatting in dev guide
  #322 update dev guide
  #322 remove the make_clean_tmpfile utility and associated tests
  #307 change GHA to run with python 3.6, 3.8 and 3.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Function_Stmt does not have get_name() method

2 participants