Add permutations challenge

This commit is contained in:
Donne Martin
2017-03-27 05:21:02 -04:00
parent ba8325329a
commit 9c0035f330
4 changed files with 439 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
from nose.tools import assert_equal
class TestPermutations(object):
def test_permutations(self):
permutations = Permutations()
assert_equal(permutations.find_permutations(None), None)
assert_equal(permutations.find_permutations(''), '')
string = 'AABC'
expected = [
'AABC', 'AACB', 'ABAC', 'ABCA',
'ACAB', 'ACBA', 'BAAC', 'BACA',
'BCAA', 'CAAB', 'CABA', 'CBAA'
]
assert_equal(permutations.find_permutations(string), expected)
print('Success: test_permutations')
def main():
test = TestPermutations()
test.test_permutations()
if __name__ == '__main__':
main()