Debian Codegraph @

python/test/unit/io/test_SVG.py

raw
1 """Unit tests for SVG output"""
2
3 # Copyright (C) 2012 Anders Logg
4 #
5 # This file is part of DOLFIN.
6 #
7 # DOLFIN is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Lesser General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # DOLFIN is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public License
18 # along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
19
20 import os
21 import pytest
22 from dolfin import *
23 from dolfin_utils.test import fixture, cd_tempdir
24
25 def test_write_mesh_1d(cd_tempdir):
26 mesh = UnitIntervalMesh(8)
27 f = File("_1d.svg")
28 f << mesh
29
30 def test_write_mesh_2d(cd_tempdir):
31 mesh = UnitSquareMesh(8, 8)
32 f = File("2d.svg")
33 f << mesh
34
35 def test_write_mesh_3d(cd_tempdir):
36 mesh = UnitCubeMesh(8, 8, 8)
37 f = File("3d.svg")
38 f << mesh
39
40 def test_ipython_svg(cd_tempdir):
41 # Test IPython SVG repr hooks
42 mesh2d = UnitSquareMesh(8, 8)
43 svg = mesh2d._repr_svg_()
44 assert '<svg' in svg
45 mesh3d = UnitCubeMesh(8, 8, 8)
46 svg = mesh3d._repr_svg_()
47 assert svg is None