﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26795	Refactor code in tests.migrations.test_autodetector	Akshesh Doshi	nobody	"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()

}}}
"	Cleanup/optimization	new	Testing framework	dev	Normal				Unreviewed	0	0	0	0	1	0
