summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2009-02-20 19:30:41 (GMT)
committerCollin Winter <collinw@gmail.com>2009-02-20 19:30:41 (GMT)
commit8725dce2ae77aeac72cdfa024a1d0aff897a6f56 (patch)
tree5892f3888692f84d6f92435080b5249ef6a4887d /Lib/test
parente9fb6863da50d843ad3e26f81b807320be385adc (diff)
downloadcpython-8725dce2ae77aeac72cdfa024a1d0aff897a6f56.zip
cpython-8725dce2ae77aeac72cdfa024a1d0aff897a6f56.tar.gz
cpython-8725dce2ae77aeac72cdfa024a1d0aff897a6f56.tar.bz2
Issue 5176: special-case string formatting in BINARY_MODULO implementation. This shows a modest (1-3%) speed-up in templating systems, for example.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_opcodes.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py
index d7d1673..7985bf6 100644
--- a/Lib/test/test_opcodes.py
+++ b/Lib/test/test_opcodes.py
@@ -102,6 +102,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)