Esempio n. 1
0
def test_ordered_with_floats():
    """Test floats are returned properly."""
    a = BST([1.8, 1.4, 1.9, 1.2])
    b = a.ordered()
    assert next(b) == 1.2
    assert next(b) == 1.4
    assert next(b) == 1.8
    assert next(b) == 1.9
Esempio n. 2
0
def test_ordered_stop_iteration():
    """Test that iteration stops."""
    a = BST([1, 2, 4])
    b = a.ordered()
    with pytest.raises(StopIteration):
        next(b)
        next(b)
        next(b)
        next(b)