MCPcopy Index your code
hub / github.com/python/cpython / test_isdecimal

Method test_isdecimal

Lib/test/test_str.py:784–800  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

782 self.assertFalse("\U0010ffff".isascii())
783
784 def test_isdecimal(self):
785 self.checkequalnofix(False, '', 'isdecimal')
786 self.checkequalnofix(False, 'a', 'isdecimal')
787 self.checkequalnofix(True, '0', 'isdecimal')
788 self.checkequalnofix(False, '\u2460', 'isdecimal') # CIRCLED DIGIT ONE
789 self.checkequalnofix(False, '\xbc', 'isdecimal') # VULGAR FRACTION ONE QUARTER
790 self.checkequalnofix(True, '\u0660', 'isdecimal') # ARABIC-INDIC DIGIT ZERO
791 self.checkequalnofix(True, '0123456789', 'isdecimal')
792 self.checkequalnofix(False, '0123456789a', 'isdecimal')
793
794 self.checkraises(TypeError, 'abc', 'isdecimal', 42)
795
796 for ch in ['\U00010401', '\U00010427', '\U00010429', '\U0001044E',
797 '\U0001F40D', '\U0001F46F', '\U00011065', '\U0001F107']:
798 self.assertFalse(ch.isdecimal(), '{!a} is not decimal.'.format(ch))
799 for ch in ['\U0001D7F6', '\U00011066', '\U000104A0']:
800 self.assertTrue(ch.isdecimal(), '{!a} is decimal.'.format(ch))
801
802 def test_isdigit(self):
803 super().test_isdigit()

Callers

nothing calls this directly

Calls 6

checkequalnofixMethod · 0.95
assertFalseMethod · 0.80
isdecimalMethod · 0.80
assertTrueMethod · 0.80
checkraisesMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected