Exemple #1
0
def test_safe_pop_first():
    data = [3, 4, 5]
    datum = safe_pop(data, 0)
    assert datum == 3, \
      'Datum should be the first element'
Exemple #2
0
def test_safe_pop_index_default():
    data = [3, 4, 5]
    datum = safe_pop(data)
    assert datum == 3, \
      'return value should be the first element by default'
Exemple #3
0
def test_safe_pop_empty():
    datum = safe_pop([])
    assert datum is None, \
      'return value should be None by default'
Exemple #4
0
def test_safe_pop_empty_default():
    datum = safe_pop([], default=0)
    assert datum == 0, \
      'return value should be 0 by default'
Exemple #5
0
def test_safe_pop_last():
    data = [3, 4, 5]
    datum = safe_pop(data, -1)
    assert datum == 5, \
      'Datum should be the last element'