コード例 #1
0
 def test_call_with_passed_extracted_iterable(self):
     obj = self.build(
         declarations.PostGenerationMethodCall('method'),
         post=(1, 2, 3),
     )
     obj.method.assert_called_once_with((1, 2, 3))
コード例 #2
0
 def test_call_with_method_kwargs(self):
     obj = self.build(
         declarations.PostGenerationMethodCall('method', data='data'), )
     obj.method.assert_called_once_with(data='data')
コード例 #3
0
 def test_call_with_passed_extracted_string(self):
     obj = self.build(
         declarations.PostGenerationMethodCall('method'),
         post='data',
     )
     obj.method.assert_called_once_with('data')
コード例 #4
0
 def test_call_with_passed_extracted_int(self):
     obj = self.build(
         declarations.PostGenerationMethodCall('method'),
         post=1,
     )
     obj.method.assert_called_once_with(1)
コード例 #5
0
 def test_multi_call_with_kwargs(self):
     decl = declarations.PostGenerationMethodCall(
             'method', 'arg1', 'arg2')
     decl.call(self.obj, False, self.ctx(extra={'x': 2}))
     self.obj.method.assert_called_once_with('arg1', 'arg2', x=2)
コード例 #6
0
 def test_simplest_setup_and_call(self):
     obj = self.build(declarations.PostGenerationMethodCall('method'), )
     obj.method.assert_called_once_with()
コード例 #7
0
 def test_call_with_passed_kwargs(self):
     decl = declarations.PostGenerationMethodCall('method')
     decl.call(self.obj, False, self.ctx(extra={'data': 'other'}))
     self.obj.method.assert_called_once_with(data='other')
コード例 #8
0
 def test_multi_call_with_multi_method_args(self):
     decl = declarations.PostGenerationMethodCall('method', 'arg1', 'arg2')
     decl.call(self.obj, False)
     self.obj.method.assert_called_once_with('arg1', 'arg2')
コード例 #9
0
 def test_call_with_passed_extracted_iterable(self):
     decl = declarations.PostGenerationMethodCall('method')
     decl.call(self.obj, False, self.ctx((1, 2, 3)))
     self.obj.method.assert_called_once_with((1, 2, 3))
コード例 #10
0
 def test_call_with_method_kwargs(self):
     decl = declarations.PostGenerationMethodCall(
             'method', data='data')
     decl.call(self.obj, False, self.ctx())
     self.obj.method.assert_called_once_with(data='data')
コード例 #11
0
 def test_call_with_passed_extracted_string(self):
     decl = declarations.PostGenerationMethodCall(
             'method')
     decl.call(self.obj, False, self.ctx('data'))
     self.obj.method.assert_called_once_with('data')
コード例 #12
0
 def test_simplest_setup_and_call(self):
     decl = declarations.PostGenerationMethodCall('method')
     decl.call(self.obj, False, self.ctx())
     self.obj.method.assert_called_once_with()
コード例 #13
0
 def test_multi_call_with_passed_multiple_args(self):
     decl = declarations.PostGenerationMethodCall('method', 'arg1', 'arg2')
     decl.call(self.obj, False, ('param1', 'param2', 'param3'))
     self.obj.method.assert_called_once_with('param1', 'param2', 'param3')
コード例 #14
0
 def test_call_with_passed_kwargs(self):
     obj = self.build(
         declarations.PostGenerationMethodCall('method'),
         post__data='other',
     )
     obj.method.assert_called_once_with(data='other')
コード例 #15
0
 def test_multi_call_with_passed_tuple(self):
     decl = declarations.PostGenerationMethodCall(
             'method', 'arg1', 'arg2')
     decl.call(self.obj, False, self.ctx((('param1', 'param2'),)))
     self.obj.method.assert_called_once_with(('param1', 'param2'))
コード例 #16
0
 def test_multi_call_with_multi_method_args(self):
     with self.assertRaises(errors.InvalidDeclarationError):
         self.build(
             declarations.PostGenerationMethodCall('method', 'arg1',
                                                   'arg2'), )
コード例 #17
0
 def test_call_with_passed_extracted_int(self):
     decl = declarations.PostGenerationMethodCall('method')
     decl.call(self.obj, False, 1)
     self.obj.method.assert_called_once_with(1)