def test_generate(self): target = "methinks it is like a weasel" lenS = len(target) print(lenS) alphabet = list("abcdefghijklmnopqrstuvwxyz") lenA = len(alphabet) for i in range(10): string = generate(lenS, lenA, alphabet) print(len(string)) self.assertEqual(len(string), lenS, "Should be equal to 28")
def testZeroLength(self): data1 = 0 data2 = 0 data3 = '' result = generate(data1, data2, data3) self.assertEqual(result, [])
def testGreaterThanZeroLength(self): data1 = 4 data2 = 4 data3 = 'abcd' resultLen = len(generate(data1, data2, data3)) self.assertEqual(resultLen, 4)
def test_generate_BaseCase(self): self.assertEqual( len(generate(0, 0, list("abcdefghijklmnopqrstuvwxyz "))), 0)
def test_generate_programCase(self): self.assertEqual( len(generate(28, 27, list("abcdefghijklmnopqrstuvwxyz "))), 28)
def test_long(self): result = generate(100000) self.assertEqual(len(result), 100000)
def test_random(self): result_1 = generate(15) result_2 = generate(15) self.assertNotEqual(result_1, result_2)
def test_short(self): result = generate(0) self.assertEqual(len(result), 0) self.assertIs