Changeset 186

Show
Ignore:
Timestamp:
12/30/06 23:28:01 (2 years ago)
Author:
akhavr
Message:

ticket:370:

  • implemented Call
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pybeast/trunk/Makefile

    r179 r186  
    3535 
    3636pylint: 
    37         pylint src 
     37        pylint src --max-public-methods=32 
    3838        pylint dtest --max-public-methods=32 
    3939        pylint ctest 
  • pybeast/trunk/dtest/py2py.py

    r185 r186  
    345345        'Test from http://docs.python.org/lib/Python.txt' 
    346346        self.reformat_and_test('(x < 3) < 4') 
     347 
     348 
     349class Call(Expr): 
     350    'Test calls' 
     351 
     352    def test_simple(self): 
     353        'Simple call' 
     354        self.reformat_and_test('func(a, b, c)') 
     355 
     356    def test_keyword_args(self): 
     357        'Call with keyword args' 
     358        self.reformat_and_test('func(a, b = b, c = c)') 
     359 
     360    def test_complete(self): 
     361        'Call with keyword and star and kw args' 
     362        self.reformat_and_test('func(a, b = b, c = c, *args, **kw)') 
    347363         
    348364     
  • pybeast/trunk/src/py2py.py

    r185 r186  
    154154            walker.dispatch(arg) 
    155155            self.code += ', ' 
    156         if len(node.args): 
     156 
     157        if node.star_args: 
     158            self.code += '*' 
     159            walker.dispatch(node.star_args) 
     160            self.code += ', ' 
     161 
     162        if node.dstar_args: 
     163            self.code += '**' 
     164            walker.dispatch(node.dstar_args) 
     165            self.code += ', ' 
     166         
     167        if len(node.args) or node.star_args or node.dstar_args: 
    157168            self.code = self.code[:-2] 
    158169 
     
    214225            for ifs in node.ifs: 
    215226                walker.dispatch(ifs) 
     227 
     228    def visit_keyword(self, node, walker): 
     229        'visit Keyword node' 
     230        self.code += node.name + ' =' 
     231        walker.dispatch(node.expr) 
    216232 
    217233    def visit_lambda(self, node, walker):