mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-02 23:48:02 +00:00
22 lines
566 B
Python
22 lines
566 B
Python
import unittest
|
|
|
|
|
|
class TestSolution(unittest.TestCase):
|
|
|
|
def test_longest_substr(self):
|
|
solution = Solution()
|
|
self.assertRaises(TypeError, solution.longest_substr, None)
|
|
self.assertEqual(solution.longest_substr('', k=3), 0)
|
|
self.assertEqual(solution.longest_substr('abcabcdefgghiij', k=3), 6)
|
|
self.assertEqual(solution.longest_substr('abcabcdefgghighij', k=3), 7)
|
|
print('Success: test_longest_substr')
|
|
|
|
|
|
def main():
|
|
test = TestSolution()
|
|
test.test_longest_substr()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|