コード例 #1
0
def test_initial_config():
    """Check that all attributes are defined properly from the config."""
    cs = CS()
    assert cs.x_min == -config["frame_x_radius"]
    assert cs.x_max == config["frame_x_radius"]
    assert cs.y_min == -config["frame_y_radius"]
    assert cs.y_max == config["frame_y_radius"]

    ax = Axes()
    assert np.allclose(ax.center_point, ORIGIN)
    assert np.allclose(ax.y_axis_config["label_direction"], LEFT)

    with tempconfig({"frame_x_radius": 100, "frame_y_radius": 200}):
        cs = CS()
        assert cs.x_min == -100
        assert cs.x_max == 100
        assert cs.y_min == -200
        assert cs.y_max == 200
コード例 #2
0
def test_initial_config():
    """Check that all attributes are defined properly from the config."""
    cs = CS()
    assert cs.x_range[0] == round(-config["frame_x_radius"])
    assert cs.x_range[1] == round(config["frame_x_radius"])
    assert cs.x_range[2] == 1.0
    assert cs.y_range[0] == round(-config["frame_y_radius"])
    assert cs.y_range[1] == round(config["frame_y_radius"])
    assert cs.y_range[2] == 1.0

    ax = Axes()
    np.testing.assert_allclose(ax.get_center(), ORIGIN)
    np.testing.assert_allclose(ax.y_axis_config["label_direction"], LEFT)

    with tempconfig({"frame_x_radius": 100, "frame_y_radius": 200}):
        cs = CS()
        assert cs.x_range[0] == -100
        assert cs.x_range[1] == 100
        assert cs.y_range[0] == -200
        assert cs.y_range[1] == 200
コード例 #3
0
def test_abstract_base_class():
    """Check that CoordinateSystem has some abstract methods."""
    with pytest.raises(Exception):
        CS().get_axes()