Factor out a "get_changes" method in tests.migrations.test_autodetector
Recently, while working in django.tests.migrations.test_autodetector I noticed that the following code is getting repeated approx 100 times:
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:
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()
Change History
(7)
| Description: |
modified (diff)
|
| Component: |
Testing framework → Migrations
|
| Description: |
modified (diff)
|
| Summary: |
Refactor code in tests.migrations.test_autodetector → Factor out a "get_changes" method in tests.migrations.test_autodetector
|
| Triage Stage: |
Unreviewed → Accepted
|
| Owner: |
changed from nobody to Akshesh Doshi
|
| Status: |
new → assigned
|
| Has patch: |
set
|
| Triage Stage: |
Accepted → Ready for checkin
|
| Resolution: |
→ fixed
|
| Status: |
assigned → closed
|
PR