mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-12 12:28:04 +00:00
Added permutation challenge.
This commit is contained in:
24
arrays_strings/permutation/test_permutation_solution.py
Normal file
24
arrays_strings/permutation/test_permutation_solution.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from nose.tools import assert_equal
|
||||
|
||||
|
||||
class TestPermutation(object):
|
||||
|
||||
def test_permutation(self, func):
|
||||
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')
|
||||
|
||||
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
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user