def test_width_spec_with_padright(rows, columns, figwidth, padright, units):
    """Width specification with right side padding."""
    assume(figwidth > padright)
    l = FigureSizeLocator(rows, columns, figwidth=figwidth, padright=padright,
                          units=units)
    figwidth_c, _ = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
def test_width_spec_with_hsep(rows, columns, figwidth, hsep, units):
    """Width specification with horizontal separation."""
    assume(figwidth > hsep * (columns - 1))
    l = FigureSizeLocator(rows, columns, figwidth=figwidth, hsep=hsep,
                          units=units)
    figwidth_c, _ = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
def test_height_spec_with_vsep(rows, columns, figheight, vsep, units):
    """Height specification with vertical separation."""
    assume(figheight > vsep * (rows - 1))
    l = FigureSizeLocator(rows, columns, figheight=figheight, vsep=vsep,
                          units=units)
    _, figheight_c = l.figsize_in(units)
    assert almost_equal(figheight_c, figheight)
def test_width_spec_with_ratio(rows, columns, figwidth, panelratio, units):
    """Width specification with aspect ratio."""
    l = FigureSizeLocator(rows, columns, figwidth=figwidth,
                          panelratio=panelratio, units=units)
    _, figheight_c = l.figsize_in(units)
    assert almost_equal(figheight_c,
                        (figwidth * rows) / (panelratio * columns))
def test_height_spec_with_padtop(rows, columns, figheight, padtop, units):
    """Height specification with top edge padding."""
    assume(figheight > padtop)
    l = FigureSizeLocator(rows, columns, figheight=figheight, padtop=padtop,
                          units=units)
    _, figheight_c = l.figsize_in(units)
    assert almost_equal(figheight_c, figheight)
def test_full_spec(rows, columns, figwidth, figheight, units):
    """Full specification (width and height) only."""
    l = FigureSizeLocator(rows, columns, figwidth=figwidth,
                          figheight=figheight, units=units)
    figwidth_c, figheight_c = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
    assert almost_equal(figheight_c, figheight)
def test_height_spec_with_pad(rows, columns, figheight, padleft, padright,
                              padtop, padbottom, units):
    """Height specification with padding on all sides."""
    assume(figheight > padtop + padbottom)
    l = FigureSizeLocator(rows, columns, figheight=figheight, padleft=padleft,
                          padright=padright, padtop=padtop,
                          padbottom=padbottom, units=units)
    _, figheight_c = l.figsize_in(units)
    assert almost_equal(figheight_c, figheight)
def test_width_spec_with_pad(rows, columns, figwidth, padleft, padright,
                             padtop, padbottom, units):
    """Width specification with padding on all sides."""
    assume(figwidth > padleft + padright)
    l = FigureSizeLocator(rows, columns, figwidth=figwidth, padleft=padleft,
                          padright=padright, padtop=padtop,
                          padbottom=padbottom, units=units)
    figwidth_c, _ = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
def test_width_spec_with_all(rows, columns, figwidth, hsep, vsep, padleft,
                             padright, padtop, padbottom, units):
    """Width specification with separation and padding."""
    assume(figwidth > padleft + (columns - 1) * hsep + padright)
    l = FigureSizeLocator(rows, columns, figwidth=figwidth,
                          hsep=hsep, vsep=vsep,
                          padleft=padleft, padright=padright,
                          padtop=padtop, padbottom=padbottom, units=units)
    figwidth_c, _ = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
def test_full_spec_with_padbottom(rows, columns, figwidth, figheight,
                                  padbottom, units):
    """Full specification with bottom edge padding."""
    assume(figheight > padbottom)
    l = FigureSizeLocator(rows, columns,
                          figwidth=figwidth, figheight=figheight,
                          padbottom=padbottom, units=units)
    figwidth_c, figheight_c = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
    assert almost_equal(figheight_c, figheight)
def test_full_spec_with_padleft(rows, columns, figwidth, figheight, padleft,
                                units):
    """Full specification with left side padding."""
    assume(figwidth > padleft)
    l = FigureSizeLocator(rows, columns,
                          figwidth=figwidth, figheight=figheight,
                          padleft=padleft, units=units)
    figwidth_c, figheight_c = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
    assert almost_equal(figheight_c, figheight)
def test_height_spec_with_all(rows, columns, figheight, hsep, vsep, padleft,
                              padright, padtop, padbottom, units):
    """Height specification with separation and padding."""
    assume(figheight > padtop + (rows - 1) * vsep + padbottom)
    l = FigureSizeLocator(rows, columns, figheight=figheight,
                          hsep=hsep, vsep=vsep,
                          padleft=padleft, padright=padright,
                          padtop=padtop, padbottom=padbottom, units=units)
    _, figheight_c = l.figsize_in(units)
    assert almost_equal(figheight_c, figheight)
def test_full_spec_with_hsep_and_vsep(rows, columns, figwidth, figheight,
                                      hsep, vsep, units):
    """Full specification with horizontal and vertical separation."""
    assume(figwidth > hsep * (columns - 1))
    assume(figheight > vsep * (rows - 1))
    l = FigureSizeLocator(rows, columns,
                          figwidth=figwidth, figheight=figheight,
                          hsep=hsep, vsep=vsep, units=units)
    figwidth_c, figheight_c = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
    assert almost_equal(figheight_c, figheight)
def test_width_spec_with_vsep(rows, columns, figwidth, vsep, units):
    """Width specification with vertical separation."""
    l = FigureSizeLocator(rows, columns, figwidth=figwidth, vsep=vsep,
                          units=units)
    figwidth_c, _ = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
def test_height_spec_with_ratio(rows, columns, figheight, panelratio, units):
    """Height specification with aspect ratio."""
    l = FigureSizeLocator(rows, columns, figheight=figheight,
                          panelratio=panelratio, units=units)
    figwidth_c, _ = l.figsize_in(units)
    assert almost_equal(figwidth_c, columns * panelratio * figheight / rows)
def test_height_spec(rows, columns, figheight, units):
    """Height specification only."""
    l = FigureSizeLocator(rows, columns, figheight=figheight, units=units)
    _, figheight_c = l.figsize_in(units)
    assert almost_equal(figheight_c, figheight)
def test_width_spec(rows, columns, figwidth, units):
    """Width specification only."""
    l = FigureSizeLocator(rows, columns, figwidth=figwidth, units=units)
    figwidth_c, _ = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
def test_height_spec_with_hsep(rows, columns, figheight, hsep, units):
    """Height specification with horizontal separation."""
    l = FigureSizeLocator(rows, columns, figheight=figheight, hsep=hsep,
                          units=units)
    _, figheight_c = l.figsize_in(units)
    assert almost_equal(figheight_c, figheight)
def test_width_spec_with_padbottom(rows, columns, figwidth, padbottom, units):
    """Width specification with bottom edge padding."""
    l = FigureSizeLocator(rows, columns, figwidth=figwidth,
                          padbottom=padbottom, units=units)
    figwidth_c, _ = l.figsize_in(units)
    assert almost_equal(figwidth_c, figwidth)
def test_height_spec_with_padright(rows, columns, figheight, padright, units):
    """Height specification with right side padding."""
    l = FigureSizeLocator(rows, columns, figheight=figheight, padright=padright,
                          units=units)
    _, figheight_c = l.figsize_in(units)
    assert almost_equal(figheight_c, figheight)