Re: [Django] #26795: Refactor code in tests.migrations.test_autodetector

2016-06-23 Thread Django
#26795: Refactor code in tests.migrations.test_autodetector
-+-
 Reporter:  akki |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Testing framework|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Description changed by akki:

Old description:

> 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()
> }}}

New description:

 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: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.016ae45dfc7469307debc4f19028af7b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #26795: Refactor code in tests.migrations.test_autodetector

2016-06-22 Thread Django
#26795: Refactor code in tests.migrations.test_autodetector
-+-
 Reporter:  akki |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Testing framework|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  1|UI/UX:  0
-+-
Changes (by akki):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * easy:  0 => 1
 * needs_docs:   => 0


--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.a1173cb1dc405372c6b706e43a269bd3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.