@@ -756,16 +756,16 @@ When we try to test that ``grob`` calls ``frob`` with the correct argument look
756756what happens:
757757
758758 >>> with patch(' mymodule.frob' ) as mock_frob:
759- ... val = set ([ 6 ])
759+ ... val = { 6 }
760760 ... mymodule.grob(val)
761761 ...
762762 >>> val
763- set([] )
764- >>> mock_frob.assert_called_with(set ([ 6 ]) )
763+ set()
764+ >>> mock_frob.assert_called_with({ 6 } )
765765 Traceback (most recent call last):
766766 ...
767- AssertionError: Expected: ((set([6]) ,), {})
768- Called with: ((set([] ),), {})
767+ AssertionError: Expected: (({6} ,), {})
768+ Called with: ((set(),), {})
769769
770770One possibility would be for mock to copy the arguments you pass in. This
771771could then cause problems if you do assertions that rely on object identity
@@ -793,12 +793,12 @@ me.
793793 ...
794794 >>> with patch(' mymodule.frob' ) as mock_frob:
795795 ... new_mock = copy_call_args(mock_frob)
796- ... val = set ([ 6 ])
796+ ... val = { 6 }
797797 ... mymodule.grob(val)
798798 ...
799- >>> new_mock.assert_called_with(set ([ 6 ]) )
799+ >>> new_mock.assert_called_with({ 6 } )
800800 >>> new_mock.call_args
801- call(set([6]) )
801+ call({6} )
802802
803803``copy_call_args `` is called with the mock that will be called. It returns a new
804804mock that we do the assertion on. The ``side_effect `` function makes a copy of
@@ -811,10 +811,10 @@ the args and calls our ``new_mock`` with the copy.
811811 checking inside a ``side_effect `` function.
812812
813813 >>> def side_effect (arg ):
814- ... assert arg == set ([ 6 ])
814+ ... assert arg == { 6 }
815815 ...
816816 >>> mock = Mock(side_effect = side_effect)
817- >>> mock(set ([ 6 ]) )
817+ >>> mock({ 6 } )
818818 >>> mock(set ())
819819 Traceback (most recent call last):
820820 ...
@@ -839,8 +839,8 @@ Here's an example implementation:
839839 >>> c.assert_called_with(arg)
840840 Traceback (most recent call last):
841841 ...
842- AssertionError: Expected call: mock(set([1]) )
843- Actual call: mock(set([] ))
842+ AssertionError: Expected call: mock({1} )
843+ Actual call: mock(set())
844844 >>> c.foo
845845 <CopyingMock name='mock.foo' id='...'>
846846
0 commit comments