Solve problem 70 in Python.
This commit is contained in:
@@ -14,6 +14,7 @@ try:
|
||||
from .lib_misc import permutations
|
||||
from .lib_misc import gcd
|
||||
from .lib_misc import get_digit_count
|
||||
from .lib_misc import is_permutation
|
||||
except ModuleNotFoundError:
|
||||
from lib_misc import is_palindrome_integer
|
||||
from lib_misc import is_palindrome_string
|
||||
@@ -29,6 +30,7 @@ except ModuleNotFoundError:
|
||||
from lib_misc import permutations
|
||||
from lib_misc import gcd
|
||||
from lib_misc import get_digit_count
|
||||
from lib_misc import is_permutation
|
||||
|
||||
|
||||
class TestPrimeMethods(unittest.TestCase):
|
||||
@@ -137,6 +139,12 @@ class TestPrimeMethods(unittest.TestCase):
|
||||
self.assertEqual(get_digit_count(1), 1)
|
||||
self.assertEqual(get_digit_count(1234567890), 10)
|
||||
|
||||
def test_is_permutation(self):
|
||||
self.assertTrue(is_permutation(123, 321))
|
||||
self.assertTrue(is_permutation(123, 321))
|
||||
self.assertFalse(is_permutation(12, 321))
|
||||
self.assertFalse(is_permutation(1235, 4321))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user