Rearrange renderer unit tests

pull/357/head
nyanpasu64 2018-08-15 22:39:48 -07:00
rodzic 58f8515967
commit 6e7b7f4048
1 zmienionych plików z 28 dodań i 24 usunięć

Wyświetl plik

@ -26,32 +26,11 @@ def test_config():
assert default.orientation == 'h'
def test_renderer():
"""
TODO check image output using:
https://matplotlib.org/devel/testing.html#writing-an-image-comparison-test
https://stackoverflow.com/a/27950953
"[I]mage comparison tests end up bring more trouble than they are worth"
"""
# 2 columns
cfg = RendererConfig(WIDTH, HEIGHT)
lcfg = LayoutConfig(ncols=2)
nplots = 15
r = MatplotlibRenderer(cfg, lcfg, nplots)
# 2 columns, 8 rows
assert r.layout.ncols == 2
assert r.layout.nrows == 8
@pytest.mark.parametrize('lcfg', [
LayoutConfig(ncols=2),
LayoutConfig(nrows=8),
])
def test_layout(lcfg):
def test_hlayout(lcfg):
nplots = 15
layout = RendererLayout(lcfg, nplots)
@ -75,7 +54,7 @@ def test_layout(lcfg):
LayoutConfig(ncols=3, orientation='v'),
LayoutConfig(nrows=3, orientation='v'),
])
def test_layout(lcfg):
def test_vlayout(lcfg):
nplots = 7
layout = RendererLayout(lcfg, nplots)
@ -90,5 +69,30 @@ def test_layout(lcfg):
assert regions[3] == '(0, 1)'
assert regions[6] == '(0, 2)'
def test_renderer():
"""
TODO check image output using:
https://matplotlib.org/devel/testing.html#writing-an-image-comparison-test
https://stackoverflow.com/a/27950953
"[I]mage comparison tests end up bring more trouble than they are worth"
"""
# 2 columns
cfg = RendererConfig(WIDTH, HEIGHT)
lcfg = LayoutConfig(ncols=2)
nplots = 15
r = MatplotlibRenderer(cfg, lcfg, nplots)
# 2 columns, 8 rows
assert r.layout.ncols == 2
assert r.layout.nrows == 8
# TODO: test get_frame()
# (integration test) ensure rendering to output works
def test_colors():
pass # TODO
# TODO (integration test) ensure rendering to output works