#26795: Refactor code in tests.migrations.test_autodetector
--------------------------------------+--------------------
     Reporter:  akki                  |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Testing framework     |    Version:  master
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------
 Recently, while working in
 
[https://github.com/django/django/blob/c2e62fd1aed093c4d9ff84e3d86e6a85c8aa1917/tests/migrations/test_autodetector.py
 django.tests.migrations.test_autodetector] I noticed that the following
 code is getting repeated approx 100 times:

 {{{
 #!python
     before = self.make_project_state([self.author_name])
     after = self.make_project_state([self.author_name_longer])
     autodetector = MigrationAutodetector(before, after)
     changes = autodetector._detect_changes()
 }}}

 I think it can be used as a simple method of the class cutting down a
 large chunk of code. Something like:
 {{{
 #!python
 def get_changes(self, before_states, after_states):
     before = self.make_project_state([self.author_name])
     after = self.make_project_state([self.author_name_longer])
     autodetector = MigrationAutodetector(before, after)
     return autodetector._detect_changes()
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26795>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/047.4833418f33cd945e8f39c9802adb2af6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to