mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-21 06:25:30 -04:00
Defer a few more matplotlib imports
This commit is contained in:
parent
664ae00cdc
commit
f2549c9470
4 changed files with 11 additions and 11 deletions
|
|
@ -6,7 +6,6 @@ import operator
|
|||
|
||||
import numpy as np
|
||||
from scipy.spatial import ConvexHull, Delaunay
|
||||
from matplotlib.path import Path
|
||||
|
||||
import openmc
|
||||
from openmc.checkvalue import (check_greater_than, check_value,
|
||||
|
|
@ -1021,6 +1020,7 @@ class Polygon(CompositeSurface):
|
|||
-------
|
||||
surfsets : a list of lists of surface, operator pairs
|
||||
"""
|
||||
from matplotlib.path import Path
|
||||
|
||||
# Get centroids of all the simplices and determine if they are inside
|
||||
# the polygon defined by input vertices or not.
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
import sys
|
||||
import openmc
|
||||
|
||||
|
||||
def test_matplotlib_presence():
|
||||
"""Checks that remains a deferred import"""
|
||||
assert 'matplotlib.pyplot' not in sys.modules
|
||||
6
tests/test_matplotlib_import.py
Normal file
6
tests/test_matplotlib_import.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import sys
|
||||
import openmc
|
||||
|
||||
def test_matplotlib_presence():
|
||||
"""Checks that matplotlib remains a deferred import"""
|
||||
assert 'matplotlib' not in sys.modules
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
import numpy as np
|
||||
import openmc
|
||||
import pytest
|
||||
from matplotlib.figure import Figure
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
|
|
@ -74,8 +73,10 @@ def test_calculate_cexs_with_materials(test_mat):
|
|||
|
||||
@pytest.mark.parametrize("this", ["Be", "Be9"])
|
||||
def test_plot_xs(this):
|
||||
assert isinstance(openmc.plotter.plot_xs(this, types=['total']), Figure)
|
||||
from matplotlib.figure import Figure
|
||||
assert isinstance(openmc.plot_xs(this, types=['total']), Figure)
|
||||
|
||||
|
||||
def test_plot_xs_mat(test_mat):
|
||||
assert isinstance(openmc.plotter.plot_xs(test_mat, types=['total']), Figure)
|
||||
from matplotlib.figure import Figure
|
||||
assert isinstance(openmc.plot_xs(test_mat, types=['total']), Figure)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue