diff -r 648b35f22b91 Lib/unittest/mock.py --- a/Lib/unittest/mock.py Fri Mar 06 12:18:06 2015 +0200 +++ b/Lib/unittest/mock.py Sat Mar 07 14:01:55 2015 +0200 @@ -1661,7 +1661,7 @@ "len contains iter " "hash str sizeof " "enter exit " - "divmod neg pos abs invert " + "divmod rdivmod neg pos abs invert " "complex int float index " "trunc floor ceil " "bool next " diff -r 648b35f22b91 Lib/unittest/test/testmock/testmagicmethods.py --- a/Lib/unittest/test/testmock/testmagicmethods.py Fri Mar 06 12:18:06 2015 +0200 +++ b/Lib/unittest/test/testmock/testmagicmethods.py Sat Mar 07 14:01:55 2015 +0200 @@ -423,6 +423,18 @@ self.assertEqual(list(m), [4, 5, 6]) self.assertEqual(list(m), []) + def test_divmod_and_rdivmod(self): + m = MagicMock() + foo = divmod(2, m) + self.assertIsInstance(foo, MagicMock) + foo_direct = m.__divmod__(2) + self.assertIsInstance(foo_direct, MagicMock) + bar = divmod(m, 2) + self.assertIsInstance(bar, MagicMock) + bar_direct = m.__rdivmod__(2) + self.assertIsInstance(bar_direct, MagicMock) + + if __name__ == '__main__': unittest.main()