Skip to content

Commit

Permalink
modularise export test
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrofelder committed Nov 15, 2023
1 parent e3dee52 commit 4ba30fc
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tests/test_export_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,29 @@
from brainrender import Scene


@pytest.mark.local
def test_export_for_web():
@pytest.fixture
def scene():
"""Provide a scene with a brain region"""
s = Scene(title="BR")

th = s.add_brain_region("TH")

s.add_label(th, "TH")
return s


path = s.export("test.html")
@pytest.mark.local
def test_export_for_web(scene):
"""Check that exporting to html creates the expected file"""
path = scene.export("test.html")
assert path == "test.html"

path = Path(path)
assert path.exists()

path.unlink()


@pytest.mark.local
def test_export_for_web_raises(scene):
"""Check that exporting with invalid file extention raises ValueError"""
with pytest.raises(ValueError):
path = s.export("test.py")
scene.export("test.py")

0 comments on commit 4ba30fc

Please sign in to comment.