Skip to content

Commit

Permalink
bug: Plot was not callable
Browse files Browse the repository at this point in the history
  • Loading branch information
pfebrer committed Nov 4, 2021
1 parent 678ea64 commit 2eb21c4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sisl/viz/_plotables.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ObjectPlotHandler(ObjectDispatcher):
def __call__(self, *args, **kwargs):
"""If the plot handler is called, we will run the default plotting function
unless the keyword method has been passed."""
return getattr(self, kwargs.pop("method", self._default))(*args, **kwargs)
return getattr(self, kwargs.pop("method", self._default) or self._default)(*args, **kwargs)


class PlotDispatch(AbstractDispatch):
Expand Down
Empty file added sisl/viz/tests/fort.1000
Empty file.
9 changes: 8 additions & 1 deletion sisl/viz/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""
from copy import deepcopy
import os
from sisl.messages import SislWarning
from sisl.messages import SislInfo, SislWarning

import pytest
import numpy as np
Expand Down Expand Up @@ -224,3 +224,10 @@ def test_subplots_arrangement(self):
class _TestAnimation(TestMultiplePlot):

PlotClass = Animation

def test_calling_Plot():
# Just check that it doesn't raise any error
with pytest.warns(SislInfo):
plot = Plot("nonexistent.LDOS")

assert isinstance(plot, GridPlot)

0 comments on commit 2eb21c4

Please sign in to comment.