mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-09 10:58:02 +00:00
Added compress challenge.
This commit is contained in:
24
arrays_strings/compress/test_compress.py
Normal file
24
arrays_strings/compress/test_compress.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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'), 'A3B1C2D4')
|
||||
print('Success: test_compress')
|
||||
|
||||
def main():
|
||||
test = TestCompress()
|
||||
test.test_compress(compress_string)
|
||||
try:
|
||||
test.test_compress(compress_string_alt)
|
||||
except NameError:
|
||||
# Alternate solutions are only defined
|
||||
# in the solutions file
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user