Skip to content

Commit

Permalink
Testing requires Seaborn and put in a better AttributeError exception…
Browse files Browse the repository at this point in the history
… if setting impossible rcParams
  • Loading branch information
gb119 committed Oct 30, 2024
1 parent f88f823 commit e568cc5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Stoner/plot/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ def __setattr__(self, name, value):
"""Ensure stylesheet can't be overwritten and provide magic for template attributes."""
if name.startswith("template_"):
attrname = _add_dots(name[9:])
if attrname not in plt.rcParams.keys():
raise AttributeError(f"{attrname} is not an attribute of matplotlib.rcParams!")
plt.rcParams[attrname] = value
super().__setattr__(name, value)
else:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ multiprocess>=0.70
dill>=0.2.8
urllib3>=1.26
dateutil>=2.8
seaborn>=0.13
1 change: 1 addition & 0 deletions tests/test-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ dependencies:
- python-dateutil >=2.8
- hyperspy
- fabio
- seaborn >=0.13

0 comments on commit e568cc5

Please sign in to comment.