Ejemplo n.º 1
0
 def test_converter_without_caster(self, mocker):
     converter_mock = mocker.stub()
     converter_mock.return_value = 2
     cast = standard.Cast(None, converter_mock)
     return_value = cast.convert(1)
     converter_mock.assert_called_with(1)
     assert return_value == 2
Ejemplo n.º 2
0
 def test_convert_with_caster(self, mocker):
     caster = mocker.Mock(return_value=2)
     converter_mock = mocker.Mock(return_value=3)
     cast = standard.Cast(caster, converter_mock)
     return_value = cast.convert(1)
     caster.assert_called_with(1)
     converter_mock.assert_called_with(2)
     assert return_value == 3