interactive-coding-challenges/arrays_strings/permutation/test_permutation_solution.py

27 lines
680 B
Python
Raw Normal View History

2015-07-04 07:56:38 +08:00
from nose.tools import assert_equal
class TestPermutation(object):
2015-07-12 03:34:14 +08:00
2015-07-04 07:56:38 +08:00
def test_permutation(self, func):
assert_equal(func(None, 'foo'), False)
2015-07-04 07:56:38 +08:00
assert_equal(func('', 'foo'), False)
assert_equal(func('Nib', 'bin'), False)
assert_equal(func('act', 'cat'), True)
assert_equal(func('a ct', 'ca t'), True)
print('Success: test_permutation')
2015-07-12 03:34:14 +08:00
2015-07-04 07:56:38 +08:00
def main():
test = TestPermutation()
test.test_permutation(permutations)
try:
test.test_permutation(permutations_alt)
except NameError:
# Alternate solutions are only defined
# in the solutions file
pass
2015-07-12 03:34:14 +08:00
2015-07-04 07:56:38 +08:00
if __name__ == '__main__':
main()