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

added universe plot tests to catch color=None and axis values #2637

Merged
merged 2 commits into from
Aug 19, 2023

Conversation

shimwell
Copy link
Member

@shimwell shimwell commented Aug 10, 2023

Description

While plotting some geometry I kept getting an empty legend, I had set legend=True so I wasn't sure why it was blank 😕

Looking through the universe.plot source code I noticed that when setting legend to True we also have to set the colours. However the check for colors was not actually being triggered as plot.colors defaults to {}

This PR fixes the logic so that passing in legend=True without setting colors now triggers a ValueError if colors is not set as well as originally intended.

I've added a test to safe guard this feature and while in the universe plot unit test I also added some asserts to check the axis labels are as expected ✔️

Fixes # (issue)

Checklist

  • I have performed a self-review of my own code
    - [x] I have run clang-format on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
    - [x] I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

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

Thanks @shimwell!

@paulromano paulromano enabled auto-merge (squash) August 18, 2023 21:54
@paulromano paulromano merged commit 0964024 into openmc-dev:develop Aug 19, 2023
16 checks passed
stchaker pushed a commit to stchaker/openmc that referenced this pull request Oct 25, 2023
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