Exemple #1
0
def test_axis_nticks_set_updates_ticks():
    axis = Axis()
    axis.limits = (0, 1)

    axis.nticks = 2
    np.testing.assert_array_equal(axis.ticks, np.array([0.0, 1.0]))

    axis.nticks = 3
    np.testing.assert_array_equal(axis.ticks, np.array([0.0, 0.5, 1.0]))

    axis.nticks = 5
    np.testing.assert_array_equal(axis.ticks,
                                  np.array([0.0, 0.25, 0.5, 0.75, 1.0]))
Exemple #2
0
def test_axis_datetime_ticks(limits, n_ticks, expected_labels):
    axis = Axis(display_length=79)
    axis.nticks = n_ticks
    axis.fit(np.array(limits))
    ticklabels = axis.ticklabels

    assert list(ticklabels) == list(expected_labels)
Exemple #3
0
def test_axis_ticks(limits, n_ticks, expected_ticks):
    """Test axis ticks generation"""
    axis = Axis(display_length=80)
    axis.limits = limits
    axis.nticks = n_ticks

    np.testing.assert_array_equal(axis.ticks, expected_ticks)
Exemple #4
0
def test_axis_property_setting(axis_property, value, expected_value):
    axis = Axis()
    axis = axis.fit((0, 1))
    axis.nticks = 3

    setattr(axis, axis_property, value)
    set_value = getattr(axis, axis_property)

    if isinstance(expected_value, np.ndarray):
        np.testing.assert_array_equal(set_value, expected_value)
    else:
        assert set_value == expected_value