Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Ensure that we're getting back the proper padding number.
:return: None
"""
self.assertEqual(getPaddingNum('@'), 1)
self.assertEqual(getPaddingNum('@@'), 2)
self.assertEqual(getPaddingNum('@@@'), 3)
self.assertEqual(getPaddingNum('#'), 4)
self.assertEqual(getPaddingNum('##'), 8)
self.assertEqual(getPaddingNum('#@'), 5)
self.assertEqual(getPaddingNum('##@@'), 10)
self.assertEqual(getPaddingNum('%01d'), 1)
self.assertEqual(getPaddingNum('%1d'), 1)
self.assertEqual(getPaddingNum('%04d'), 4)
self.assertEqual(getPaddingNum('%10d'), 10)
self.assertEqual(getPaddingNum('%00d'), 1)
self.assertEqual(getPaddingNum('%0d'), 1)
self.assertEqual(getPaddingNum('%d'), 1)
self.assertEqual(getPaddingNum('$F'), 1)
self.assertEqual(getPaddingNum('$F1'), 1)
self.assertEqual(getPaddingNum('$F2'), 2)
self.assertEqual(getPaddingNum('$F3'), 3)
allPossibleChars = [s for s in string.printable if s not in PAD_MAP]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, char)
self.assertRaises(ValueError, getPaddingNum, '#{}'.format(char))
self.assertRaises(ValueError, getPaddingNum, '@{}'.format(char))
allPossibleChars = [s for s in string.printable if s not in PAD_MAP and s not in string.digits]
def testGetPaddingNum(self):
"""
Ensure that we're getting back the proper padding number.
:return: None
"""
self.assertEqual(getPaddingNum('@'), 1)
self.assertEqual(getPaddingNum('@@'), 2)
self.assertEqual(getPaddingNum('@@@'), 3)
self.assertEqual(getPaddingNum('#'), 4)
self.assertEqual(getPaddingNum('##'), 8)
self.assertEqual(getPaddingNum('#@'), 5)
self.assertEqual(getPaddingNum('##@@'), 10)
self.assertEqual(getPaddingNum('%01d'), 1)
self.assertEqual(getPaddingNum('%1d'), 1)
self.assertEqual(getPaddingNum('%04d'), 4)
self.assertEqual(getPaddingNum('%10d'), 10)
self.assertEqual(getPaddingNum('%00d'), 1)
self.assertEqual(getPaddingNum('%0d'), 1)
self.assertEqual(getPaddingNum('%d'), 1)
self.assertEqual(getPaddingNum('$F'), 1)
self.assertEqual(getPaddingNum('$F1'), 1)
self.assertEqual(getPaddingNum('$F2'), 2)
self.assertEqual(getPaddingNum('$F3'), 3)
:return: None
"""
self.assertEqual(getPaddingNum('@'), 1)
self.assertEqual(getPaddingNum('@@'), 2)
self.assertEqual(getPaddingNum('@@@'), 3)
self.assertEqual(getPaddingNum('#'), 4)
self.assertEqual(getPaddingNum('##'), 8)
self.assertEqual(getPaddingNum('#@'), 5)
self.assertEqual(getPaddingNum('##@@'), 10)
self.assertEqual(getPaddingNum('%01d'), 1)
self.assertEqual(getPaddingNum('%1d'), 1)
self.assertEqual(getPaddingNum('%04d'), 4)
self.assertEqual(getPaddingNum('%10d'), 10)
self.assertEqual(getPaddingNum('%00d'), 1)
self.assertEqual(getPaddingNum('%0d'), 1)
self.assertEqual(getPaddingNum('%d'), 1)
self.assertEqual(getPaddingNum('$F'), 1)
self.assertEqual(getPaddingNum('$F1'), 1)
self.assertEqual(getPaddingNum('$F2'), 2)
self.assertEqual(getPaddingNum('$F3'), 3)
allPossibleChars = [s for s in string.printable if s not in PAD_MAP]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, char)
self.assertRaises(ValueError, getPaddingNum, '#{}'.format(char))
self.assertRaises(ValueError, getPaddingNum, '@{}'.format(char))
allPossibleChars = [s for s in string.printable if s not in PAD_MAP and s not in string.digits]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, '%{}d'.format(char))
Ensure that we're getting back the proper padding number.
:return: None
"""
self.assertEqual(getPaddingNum('@'), 1)
self.assertEqual(getPaddingNum('@@'), 2)
self.assertEqual(getPaddingNum('@@@'), 3)
self.assertEqual(getPaddingNum('#'), 4)
self.assertEqual(getPaddingNum('##'), 8)
self.assertEqual(getPaddingNum('#@'), 5)
self.assertEqual(getPaddingNum('##@@'), 10)
self.assertEqual(getPaddingNum('%01d'), 1)
self.assertEqual(getPaddingNum('%1d'), 1)
self.assertEqual(getPaddingNum('%04d'), 4)
self.assertEqual(getPaddingNum('%10d'), 10)
self.assertEqual(getPaddingNum('%00d'), 1)
self.assertEqual(getPaddingNum('%0d'), 1)
self.assertEqual(getPaddingNum('%d'), 1)
self.assertEqual(getPaddingNum('$F'), 1)
self.assertEqual(getPaddingNum('$F1'), 1)
self.assertEqual(getPaddingNum('$F2'), 2)
self.assertEqual(getPaddingNum('$F3'), 3)
allPossibleChars = [s for s in string.printable if s not in PAD_MAP]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, char)
self.assertRaises(ValueError, getPaddingNum, '#{}'.format(char))
self.assertRaises(ValueError, getPaddingNum, '@{}'.format(char))
allPossibleChars = [s for s in string.printable if s not in PAD_MAP and s not in string.digits]
for char in allPossibleChars:
"""
self.assertEqual(getPaddingNum('@'), 1)
self.assertEqual(getPaddingNum('@@'), 2)
self.assertEqual(getPaddingNum('@@@'), 3)
self.assertEqual(getPaddingNum('#'), 4)
self.assertEqual(getPaddingNum('##'), 8)
self.assertEqual(getPaddingNum('#@'), 5)
self.assertEqual(getPaddingNum('##@@'), 10)
self.assertEqual(getPaddingNum('%01d'), 1)
self.assertEqual(getPaddingNum('%1d'), 1)
self.assertEqual(getPaddingNum('%04d'), 4)
self.assertEqual(getPaddingNum('%10d'), 10)
self.assertEqual(getPaddingNum('%00d'), 1)
self.assertEqual(getPaddingNum('%0d'), 1)
self.assertEqual(getPaddingNum('%d'), 1)
self.assertEqual(getPaddingNum('$F'), 1)
self.assertEqual(getPaddingNum('$F1'), 1)
self.assertEqual(getPaddingNum('$F2'), 2)
self.assertEqual(getPaddingNum('$F3'), 3)
allPossibleChars = [s for s in string.printable if s not in PAD_MAP]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, char)
self.assertRaises(ValueError, getPaddingNum, '#{}'.format(char))
self.assertRaises(ValueError, getPaddingNum, '@{}'.format(char))
allPossibleChars = [s for s in string.printable if s not in PAD_MAP and s not in string.digits]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, '%{}d'.format(char))
def testGetPaddingNum(self):
"""
Ensure that we're getting back the proper padding number.
:return: None
"""
self.assertEqual(getPaddingNum('@'), 1)
self.assertEqual(getPaddingNum('@@'), 2)
self.assertEqual(getPaddingNum('@@@'), 3)
self.assertEqual(getPaddingNum('#'), 4)
self.assertEqual(getPaddingNum('##'), 8)
self.assertEqual(getPaddingNum('#@'), 5)
self.assertEqual(getPaddingNum('##@@'), 10)
self.assertEqual(getPaddingNum('%01d'), 1)
self.assertEqual(getPaddingNum('%1d'), 1)
self.assertEqual(getPaddingNum('%04d'), 4)
self.assertEqual(getPaddingNum('%10d'), 10)
self.assertEqual(getPaddingNum('%00d'), 1)
self.assertEqual(getPaddingNum('%0d'), 1)
self.assertEqual(getPaddingNum('%d'), 1)
self.assertEqual(getPaddingNum('$F'), 1)
self.assertEqual(getPaddingNum('$F1'), 1)
self.assertEqual(getPaddingNum('$F2'), 2)
self.assertEqual(getPaddingNum('$F3'), 3)
allPossibleChars = [s for s in string.printable if s not in PAD_MAP]
for char in allPossibleChars:
self.assertEqual(getPaddingNum('@@'), 2)
self.assertEqual(getPaddingNum('@@@'), 3)
self.assertEqual(getPaddingNum('#'), 4)
self.assertEqual(getPaddingNum('##'), 8)
self.assertEqual(getPaddingNum('#@'), 5)
self.assertEqual(getPaddingNum('##@@'), 10)
self.assertEqual(getPaddingNum('%01d'), 1)
self.assertEqual(getPaddingNum('%1d'), 1)
self.assertEqual(getPaddingNum('%04d'), 4)
self.assertEqual(getPaddingNum('%10d'), 10)
self.assertEqual(getPaddingNum('%00d'), 1)
self.assertEqual(getPaddingNum('%0d'), 1)
self.assertEqual(getPaddingNum('%d'), 1)
self.assertEqual(getPaddingNum('$F'), 1)
self.assertEqual(getPaddingNum('$F1'), 1)
self.assertEqual(getPaddingNum('$F2'), 2)
self.assertEqual(getPaddingNum('$F3'), 3)
allPossibleChars = [s for s in string.printable if s not in PAD_MAP]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, char)
self.assertRaises(ValueError, getPaddingNum, '#{}'.format(char))
self.assertRaises(ValueError, getPaddingNum, '@{}'.format(char))
allPossibleChars = [s for s in string.printable if s not in PAD_MAP and s not in string.digits]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, '%{}d'.format(char))
allPossibleChars = [s for s in string.printable if s not in PAD_MAP and s not in string.digits]
for char in allPossibleChars:
def testGetPaddingNum(self):
"""
Ensure that we're getting back the proper padding number.
:return: None
"""
self.assertEqual(getPaddingNum('@'), 1)
self.assertEqual(getPaddingNum('@@'), 2)
self.assertEqual(getPaddingNum('@@@'), 3)
self.assertEqual(getPaddingNum('#'), 4)
self.assertEqual(getPaddingNum('##'), 8)
self.assertEqual(getPaddingNum('#@'), 5)
self.assertEqual(getPaddingNum('##@@'), 10)
self.assertEqual(getPaddingNum('%01d'), 1)
self.assertEqual(getPaddingNum('%1d'), 1)
self.assertEqual(getPaddingNum('%04d'), 4)
self.assertEqual(getPaddingNum('%10d'), 10)
self.assertEqual(getPaddingNum('%00d'), 1)
self.assertEqual(getPaddingNum('%0d'), 1)
self.assertEqual(getPaddingNum('%d'), 1)
self.assertEqual(getPaddingNum('$F'), 1)
self.assertEqual(getPaddingNum('$F1'), 1)
self.assertEqual(getPaddingNum('##'), 8)
self.assertEqual(getPaddingNum('#@'), 5)
self.assertEqual(getPaddingNum('##@@'), 10)
self.assertEqual(getPaddingNum('%01d'), 1)
self.assertEqual(getPaddingNum('%1d'), 1)
self.assertEqual(getPaddingNum('%04d'), 4)
self.assertEqual(getPaddingNum('%10d'), 10)
self.assertEqual(getPaddingNum('%00d'), 1)
self.assertEqual(getPaddingNum('%0d'), 1)
self.assertEqual(getPaddingNum('%d'), 1)
self.assertEqual(getPaddingNum('$F'), 1)
self.assertEqual(getPaddingNum('$F1'), 1)
self.assertEqual(getPaddingNum('$F2'), 2)
self.assertEqual(getPaddingNum('$F3'), 3)
allPossibleChars = [s for s in string.printable if s not in PAD_MAP]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, char)
self.assertRaises(ValueError, getPaddingNum, '#{}'.format(char))
self.assertRaises(ValueError, getPaddingNum, '@{}'.format(char))
allPossibleChars = [s for s in string.printable if s not in PAD_MAP and s not in string.digits]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, '%{}d'.format(char))
allPossibleChars = [s for s in string.printable if s not in PAD_MAP and s not in string.digits]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, '$F{}'.format(char))
self.assertEqual(getPaddingNum('#'), 4)
self.assertEqual(getPaddingNum('##'), 8)
self.assertEqual(getPaddingNum('#@'), 5)
self.assertEqual(getPaddingNum('##@@'), 10)
self.assertEqual(getPaddingNum('%01d'), 1)
self.assertEqual(getPaddingNum('%1d'), 1)
self.assertEqual(getPaddingNum('%04d'), 4)
self.assertEqual(getPaddingNum('%10d'), 10)
self.assertEqual(getPaddingNum('%00d'), 1)
self.assertEqual(getPaddingNum('%0d'), 1)
self.assertEqual(getPaddingNum('%d'), 1)
self.assertEqual(getPaddingNum('$F'), 1)
self.assertEqual(getPaddingNum('$F1'), 1)
self.assertEqual(getPaddingNum('$F2'), 2)
self.assertEqual(getPaddingNum('$F3'), 3)
allPossibleChars = [s for s in string.printable if s not in PAD_MAP]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, char)
self.assertRaises(ValueError, getPaddingNum, '#{}'.format(char))
self.assertRaises(ValueError, getPaddingNum, '@{}'.format(char))
allPossibleChars = [s for s in string.printable if s not in PAD_MAP and s not in string.digits]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, '%{}d'.format(char))
allPossibleChars = [s for s in string.printable if s not in PAD_MAP and s not in string.digits]
for char in allPossibleChars:
self.assertRaises(ValueError, getPaddingNum, '$F{}'.format(char))