Esempio n. 1
0
    def test_string_randomness(self, length):
        if length > 3:
            randomness_index = 0
            for i in range(10):
                if abc_random_string(length) == abc_random_string(length):
                    randomness_index += 1

            assert randomness_index < 4
def test_abc_random_string(abc_input, check_abc):
    abc_result = function.abc_random_string(abc_input)
    print('print abc_result: ', abc_result)

    # checking first 3 letters of new string
    abc_result_2 = abc_result[0:3]  #0:3 = abc
    print('print abc_result_2: ', abc_result_2)
    assert abc_result_2 == check_abc

    #	checking if new string is longer than abc
    assert len(abc_result) > len(check_abc)
Esempio n. 3
0
 def test_starts_with_abc(self, length):
     beginning = 'abc'
     assert abc_random_string(length)[:3] == beginning[:length]
Esempio n. 4
0
 def test_negative_length_raise(self):
     with pytest.raises(ValueError):
         assert abc_random_string(-42)
Esempio n. 5
0
 def test_wrong_structures_raises(self, structures):
     with pytest.raises(TypeError):
         assert abc_random_string(structures)
Esempio n. 6
0
 def test_string_length(self, length):
     assert len(abc_random_string(length)) == length