def test_magic_methods(self):

    class BuiltinSubclass(list):
        attr = {}
    mock = create_autospec(BuiltinSubclass)
    self.assertEqual(list(mock), [])
    self.assertRaises(TypeError, int, mock)
    self.assertRaises(TypeError, int, mock.attr)
    self.assertEqual(list(mock), [])
    self.assertIsInstance(mock['foo'], MagicMock)
    self.assertIsInstance(mock.attr['foo'], MagicMock)
def test_magic_methods(self):

    class BuiltinSubclass(list):
        attr = {}
    mock = create_autospec(BuiltinSubclass)
    self.assertEqual(list(mock), [])
    self.assertRaises(TypeError, int, mock)
    self.assertRaises(TypeError, int, mock.attr)
    self.assertEqual(list(mock), [])
    self.assertIsInstance(mock['foo'], MagicMock)
    self.assertIsInstance(mock.attr['foo'], MagicMock)