interactive-coding-challenges/arrays_strings/compress/test_compress.py
Donne Martin 4953e6c114 Update compress solution so AAAAB becomes A4B.
Previously the solution would yield A4B1, which doesn't have as much compression.
2016-02-09 06:52:32 -05:00

20 lines
434 B
Python

from nose.tools import assert_equal
class TestCompress(object):
def test_compress(self, func):
assert_equal(func(None), None)
assert_equal(func(''), '')
assert_equal(func('AABBCC'), 'AABBCC')
assert_equal(func('AAABCCDDDD'), 'A3BC2D4')
print('Success: test_compress')
def main():
test = TestCompress()
test.test_compress(compress_string)
if __name__ == '__main__':
main()