Пример #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)