{{{
#!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.
* needs_better_patch: => 0
* needs_tests: => 0
* easy: 0 => 1
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26795#comment:1>
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: <https://code.djangoproject.com/ticket/26795#comment:2>
* component: Testing framework => Migrations
* stage: Unreviewed => Accepted
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(before_states)
after = self.make_project_state(after_states)
autodetector = MigrationAutodetector(before, after)
return autodetector._detect_changes()
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/26795#comment:3>
* owner: nobody => akki
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/26795#comment:4>
* has_patch: 0 => 1
* stage: Accepted => Ready for checkin
Comment:
[https://github.com/django/django/pull/6830 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/26795#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"ca77b509059831b055a3b735ff77e042f8e1c0eb" ca77b509]:
{{{
#!CommitTicketReference repository=""
revision="ca77b509059831b055a3b735ff77e042f8e1c0eb"
Fixed #26795 -- Factored out get_changes() in test_autodetector.py.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26795#comment:6>
Comment (by Tim Graham <timograham@…>):
In [changeset:"7f249e73dd9a44f2554d43df17617ab8f9dd0c46" 7f249e73]:
{{{
#!CommitTicketReference repository=""
revision="7f249e73dd9a44f2554d43df17617ab8f9dd0c46"
[1.10.x] Fixed #26795 -- Factored out get_changes() in
test_autodetector.py.
Backport of ca77b509059831b055a3b735ff77e042f8e1c0eb from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26795#comment:7>