File: func_noerror_factory_post_generation.py

package info (click to toggle)
pylint-django 2.0.13-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 660 kB
  • sloc: python: 1,807; sh: 13; makefile: 5
file content (17 lines) | stat: -rw-r--r-- 425 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""
Checks that Pylint does not complain about no self argument in
factory.post_generation method.
"""
#  pylint: disable=missing-docstring,too-few-public-methods,unused-argument,no-member
import factory


class SomeModelFactory(factory.Factory):
    class Meta:
        pass

    @factory.post_generation
    def action(obj, create, extracted, **kwargs):
        if extracted:
            obj.do_action()
        obj.save()