Exemplo n.º 1
0
def test_closest_ph__very_small_target_extent():

    ph_list = _ph_list()

    target_extent = 2.0

    closest_index = analysis.closest_ph(ph_list,
                                        target_extent,
                                        method='from_above')
    assert_equal(closest_index, 6)

    closest_index = analysis.closest_ph(ph_list,
                                        target_extent,
                                        method='from_below')
    assert_equal(closest_index, 6)

    closest_index = analysis.closest_ph(ph_list,
                                        target_extent,
                                        method='nearest')
    assert_equal(closest_index, 6)
Exemplo n.º 2
0
def test_closest_ph__exact_match_target_extent():

    ph_list = _ph_list()

    target_extent = 24.0

    closest_index = analysis.closest_ph(ph_list,
                                        target_extent,
                                        method='from_above')
    assert_equal(closest_index, 2)

    closest_index = analysis.closest_ph(ph_list,
                                        target_extent,
                                        method='from_below')
    assert_equal(closest_index, 2)

    closest_index = analysis.closest_ph(ph_list,
                                        target_extent,
                                        method='nearest')
    assert_equal(closest_index, 2)
Exemplo n.º 3
0
def test_closest_ph__reasonable_target_extent():

    ph_list = _ph_list()

    target_extent = 6.0

    closest_index = analysis.closest_ph(ph_list,
                                        target_extent,
                                        method='from_above')
    assert_equal(closest_index, 5)

    closest_index = analysis.closest_ph(ph_list,
                                        target_extent,
                                        method='from_below')
    assert_equal(closest_index, 6)

    closest_index = analysis.closest_ph(ph_list,
                                        target_extent,
                                        method='nearest')
    assert_equal(closest_index, 5)