Anonymous avatar Anonymous committed 0e7fbe9

Added multiply operation to unrepr

Comments (0)

Files changed (2)

cherrypy/lib/reprconf.py

     def build_Add(self, o):
         left, right = map(self.build, o.getChildren())
         return left + right
+
+    def build_Mul(self, o):
+        left, right = map(self.build, o.getChildren())
+        return left * right
     
     def build_Getattr(self, o):
         parent = self.build(o.expr)
 
     def build_Add(self, o):
         return _operator.add
+
+    def build_Mult(self, o):
+        return _operator.mul
         
     def build_USub(self, o):
         return _operator.neg

cherrypy/test/test_config.py

 thing1: cherrypy.lib.httputil.response_codes[404]
 thing2: __import__('cherrypy.tutorial', globals(), locals(), ['']).thing2
 complex: 3+2j
+mul: 6*3
 ones: "11"
 twos: "22"
 stradd: %%(ones)s + %%(twos)s + "33"
         self.getPage("/repr?key=complex")
         self.assertBody("(3+2j)")
 
+        self.getPage("/repr?key=mul")
+        self.assertBody("18")
+
         self.getPage("/repr?key=stradd")
         self.assertBody(repr("112233"))
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.