MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_str_operations

Method test_str_operations

Lib/test/test_descr.py:3732–3776  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3730 self.fail("hash() of list subclass should fail")
3731
3732 def test_str_operations(self):
3733 try: 'a' + 5
3734 except TypeError: pass
3735 else: self.fail("'' + 5 doesn't raise TypeError")
3736
3737 try: ''.split('')
3738 except ValueError: pass
3739 else: self.fail("''.split('') doesn't raise ValueError")
3740
3741 try: ''.join([0])
3742 except TypeError: pass
3743 else: self.fail("''.join([0]) doesn't raise TypeError")
3744
3745 try: ''.rindex('5')
3746 except ValueError: pass
3747 else: self.fail("''.rindex('5') doesn't raise ValueError")
3748
3749 try: '%(n)s' % None
3750 except TypeError: pass
3751 else: self.fail("'%(n)s' % None doesn't raise TypeError")
3752
3753 try: '%(n' % {}
3754 except ValueError: pass
3755 else: self.fail("'%(n' % {} '' doesn't raise ValueError")
3756
3757 try: '%*s' % ('abc')
3758 except TypeError: pass
3759 else: self.fail("'%*s' % ('abc') doesn't raise TypeError")
3760
3761 try: '%*.*s' % ('abc', 5)
3762 except TypeError: pass
3763 else: self.fail("'%*.*s' % ('abc', 5) doesn't raise TypeError")
3764
3765 try: '%s' % (1, 2)
3766 except TypeError: pass
3767 else: self.fail("'%s' % (1, 2) doesn't raise TypeError")
3768
3769 try: '%' % None
3770 except ValueError: pass
3771 else: self.fail("'%' % None doesn't raise ValueError")
3772
3773 self.assertEqual('534253'.isdigit(), 1)
3774 self.assertEqual('534253x'.isdigit(), 0)
3775 self.assertEqual('%c' % 5, '\x05')
3776 self.assertEqual('%c' % '5', '5')
3777
3778 def test_deepcopy_recursive(self):
3779 # Testing deepcopy of recursive objects...

Callers

nothing calls this directly

Calls 6

failMethod · 0.45
splitMethod · 0.45
joinMethod · 0.45
rindexMethod · 0.45
assertEqualMethod · 0.45
isdigitMethod · 0.45

Tested by

no test coverage detected