Merged revisions 69811,69947 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69811 | collin.winter | 2009-02-20 13:30:41 -0600 (Fri, 20 Feb 2009) | 2 lines

  Issue 5176: special-case string formatting in BINARY_MODULO implementation. This shows a modest (1-3%) speed-up in templating systems, for example.
........
  r69947 | jeffrey.yasskin | 2009-02-24 16:48:34 -0600 (Tue, 24 Feb 2009) | 3 lines

  Tools/scripts/analyze_dxp.py, a module with some helper functions to
  analyze the output of sys.getdxp().
........
This commit is contained in:
Benjamin Peterson 2009-02-26 18:55:48 +00:00
parent e3a2980644
commit efb06b0d91
4 changed files with 140 additions and 1 deletions

View file

@ -98,6 +98,12 @@ class OpcodeTest(unittest.TestCase):
g = eval('lambda a=1: None')
self.assertNotEquals(f, g)
def test_modulo_of_string_subclasses(self):
class MyString(str):
def __mod__(self, value):
return 42
self.assertEqual(MyString() % 3, 42)
def test_main():
run_unittest(OpcodeTest)