Skip to content

Reinstate CubeList._repr_html_()#4976

Merged
lbdreyer merged 6 commits into
SciTools:v3.3.xfrom
pp-mo:fix_cubelist_print
Sep 23, 2022
Merged

Reinstate CubeList._repr_html_()#4976
lbdreyer merged 6 commits into
SciTools:v3.3.xfrom
pp-mo:fix_cubelist_print

Conversation

@pp-mo

@pp-mo pp-mo commented Sep 21, 2022

Copy link
Copy Markdown
Member

🚀 Pull Request

To address #4973

NOTE: aiming this at a bugfix release, so it is derived from, and targetting '3.3.x' branch.

TODO:

  • add whatsnew
    • ( create appropriate new whatsnew/latest.rst, on v3.3.x aiming for 3.3.1 )

@pp-mo

pp-mo commented Sep 21, 2022

Copy link
Copy Markdown
Member Author

Pure tests to start with -- proving that the test for Cubelist._repr_html_() will fail.

@pp-mo

pp-mo commented Sep 21, 2022

Copy link
Copy Markdown
Member Author

... and that should fix it.

@pp-mo pp-mo changed the base branch from main to v3.3.x September 21, 2022 16:50
@pp-mo pp-mo marked this pull request as ready for review September 21, 2022 17:06
@pp-mo

pp-mo commented Sep 21, 2022

Copy link
Copy Markdown
Member Author

Ok, naming @trexfeathers and @lbdreyer as possible reviewers.
@lbdreyer simply because I'm still easing into Pytest usage.

We need to consider the implications for this going in a 3.3.1 release.
TODO: (for me) work out what a whatsnew "latest.rst" should look like in this case + initiate it.

@pp-mo pp-mo changed the title Test the calls implementing Cube and Cubelist printing, and repr_html(). Reinstate CubeList._repr_html_() Sep 21, 2022
@lbdreyer

Copy link
Copy Markdown
Member

Regarding

TODO: (for me) work out what a whatsnew "latest.rst" should look like in this case + initiate it.

Rather than editing latest.rst. I think you just need to edit the 3.3.rst to add a section for bug fixes (as we did in https://github.com/SciTools/iris/pull/4604/files) and then add your whats new entry to this?

@pp-mo

pp-mo commented Sep 22, 2022

Copy link
Copy Markdown
Member Author

Regarding

TODO: (for me) work out what a whatsnew "latest.rst" should look like in this case + initiate it.

Rather than editing latest.rst. I think you just need to edit the 3.3.rst to add a section for bug fixes (as we did in https://github.com/SciTools/iris/pull/4604/files) and then add your whats new entry to this?

Ok thanks, that makes sense !
I tried to consult the developer docs, but it isn't really clear about this IMHO

@lbdreyer lbdreyer 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.

Tests look great! Just a few small comments

Comment thread lib/iris/tests/unit/cube/test_Cube.py Outdated
def test_two_with_same_name(self, cube):
# If a cube has two _DimensionalMetadata objects with the same name, the
def test_two_with_same_name(self, simplecube):
# If a simplecube has two _DimensionalMetadata objects with the same name, the

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.

I don't think you need to update these comments as "If a cube has two _DimensionalMetadata objects..." makes sense

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍 Rename+replace gone too far !

Comment thread lib/iris/tests/unit/cube/test_Cube.py Outdated
class TestReprs:
"""
Confirm that str(cube), repr(cube) and cube.summary() work by creating a fresh
fresh :class:`iris._representation.cube_printout.CubePrinter` object, and using it

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.

You have the word fresh twice here
"work by creating a fresh fresh :class:iris._representation.cube_printout.CubePrinter"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍 !


target = "iris.experimental.representation.CubeListRepresentation"
instance_mock = mock.MagicMock(
repr_html=mock.MagicMock() # return_value='') # NB this must return a string

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.

Is this true as the return value doesn't seem to be being used?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍 good spot !
Copied from the 'cube' case, where it did matter -- will fix.

@pp-mo

pp-mo commented Sep 22, 2022

Copy link
Copy Markdown
Member Author

Thanks @lbdreyer
Hope I have fixed those things now.

N.B. I am just about to check actual notebook output, but I tidied my conda + it is taking ages to build a test env ...
Best to wait for that.

@pp-mo

pp-mo commented Sep 23, 2022

Copy link
Copy Markdown
Member Author

Ok I think this will work now :
Fixed the glitch in the whatsnew.
I also checked that it does work as expected in a notebook ✔️

Comment thread docs/src/whatsnew/3.3.rst Outdated
Co-authored-by: lbdreyer <lbdreyer@users.noreply.github.com>
@lbdreyer lbdreyer merged commit 1d6d979 into SciTools:v3.3.x Sep 23, 2022
@lbdreyer

Copy link
Copy Markdown
Member

Whoops, Looks like there was a problem with the docs build from this merge: https://readthedocs.org/projects/scitools-iris/builds/18152663/

@pp-mo

pp-mo commented Sep 26, 2022

Copy link
Copy Markdown
Member Author

Whoops, Looks like there was a problem with the docs build from this merge: https://readthedocs.org/projects/scitools-iris/builds/18152663/

Some kind of HDF error, could be a bit of a random glitch ?
Just trying a re-build : https://readthedocs.org/projects/scitools-iris/builds/18168111/

@pp-mo

pp-mo commented Sep 26, 2022

Copy link
Copy Markdown
Member Author

Ok it has built, but my new whatsnew is not properly contained in the dropdown section
Need more indent.
However, I think we should shortly be adding to this section in #4933, so I will fix it there ...

@pp-mo pp-mo deleted the fix_cubelist_print branch September 26, 2022 13:54
stephenworsley added a commit to stephenworsley/iris that referenced this pull request Sep 29, 2022
* v3.3.x:
  Update whatsnew for 3.3.1 release (SciTools#5002)
  Port dependency fixes to `v3.3.x`. (SciTools#4992)
  Fix name loader problem (SciTools#4933)
  Reinstate CubeList._repr_html_() (SciTools#4976)

# Conflicts:
#	.github/workflows/ci-tests.yml
#	requirements/ci/nox.lock/py310-linux-64.lock
#	requirements/ci/nox.lock/py38-linux-64.lock
#	requirements/ci/nox.lock/py39-linux-64.lock
#	requirements/ci/py310.yml
#	requirements/ci/py38.yml
#	requirements/ci/py39.yml
#	setup.cfg
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