Opened 8 years ago
Last modified 8 years ago
#26795 closed Cleanup/optimization
Factor out a "get_changes" method in tests.migrations.test_autodetector — at Version 3
Reported by: | Akshesh Doshi | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
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 (3)
comment:1 by , 8 years ago
Easy pickings: | set |
---|
comment:2 by , 8 years ago
Description: | modified (diff) |
---|
comment:3 by , 8 years ago
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 |
Note:
See TracTickets
for help on using tickets.