  
          self.assertEqual(actual, expected)
  
  
  @override_settings(ROOT_URLCONF='tests.test_viewsets')
  class GetExtraActionUrlMapTests(TestCase):
  
      def test_list_view(self):
 
</s> remove     return hasattr(attr, 'mapping')
 </s> add     return hasattr(attr, 'mapping') and isinstance(attr.mapping, MethodMapper)
    def test_should_only_return_decorated_methods(self):
        view = ActionViewSetWithMapping()
        actual = [action.__name__ for action in view.get_extra_actions()]
        expected = [
            'custom_detail_action',
            'custom_list_action',
            'detail_action',
            'list_action',
            'unresolvable_detail_action',
        ]
        self.assertEqual(actual, expected)

  
          self.assertEqual(actual, expected)
  
    def test_should_only_return_decorated_methods(self):
        view = ActionViewSetWithMapping()
        actual = [action.__name__ for action in view.get_extra_actions()]
        expected = [
            'custom_detail_action',
            'custom_list_action',
            'detail_action',
            'list_action',
            'unresolvable_detail_action',
        ]
        self.assertEqual(actual, expected)

  
  @override_settings(ROOT_URLCONF='tests.test_viewsets')
  class GetExtraActionUrlMapTests(TestCase):
  
      def test_list_view(self):
keep keep add keep keep keep keep keep
 Extra action detection is too permissive. Add failing test + fix (#7217)

* Add failing test

* Add failing test++

* Make get_extra_action less permissive 
tests/test_viewsets.py