Ejemplo n.º 1
0
def test_numbers_in_string_05():
    # random
    for _ in range(100):
        stringy = "".join(
            random.choices([str(i) for i in list(range(0, 10))] +
                           list(string.ascii_lowercase),
                           k=random.randint(0, 50)))
        int_list = []
        for symbol in stringy:
            if symbol.isnumeric():
                int_list.append(int(symbol))
        assert exam.numbers_in_string(stringy) == int_list
Ejemplo n.º 2
0
def test_numbers_in_string_04():
    # empty string
    assert exam.numbers_in_string("") == []
Ejemplo n.º 3
0
def test_numbers_in_string_02():
    # some numbers
    assert exam.numbers_in_string("a1karamba") == [1]
    assert exam.numbers_in_string("fb23gs3g1") == [2, 3, 3, 1]
    assert exam.numbers_in_string("1k6jd93hsa") == [1, 6, 9, 3]
Ejemplo n.º 4
0
def test_numbers_in_string_03():
    # all numbers
    assert exam.numbers_in_string("12321") == [1, 2, 3, 2, 1]
    assert exam.numbers_in_string("000") == [0, 0, 0]
Ejemplo n.º 5
0
def test_numbers_in_string_01():
    # no numbers
    assert exam.numbers_in_string("qwerty") == []
    assert exam.numbers_in_string("o/") == []