#27253 closed Cleanup/optimization (invalid)
Use assertIsInstance() in test_force_text_lazy
Reported by: | Chris Jerdonek | Owned by: | nobody |
---|---|---|---|
Component: | Utilities | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
It looks like it would be cleaner / simpler to be using assertIsInstance()
here (direct code link):
def test_force_text_lazy(self): s = SimpleLazyObject(lambda: 'x') self.assertTrue(issubclass(type(force_text(s)), six.text_type))
So it would be:
def test_force_text_lazy(self): s = SimpleLazyObject(lambda: 'x') self.assertIsInstance(force_text(s), six.text_type)
Change History (2)
comment:1 by , 8 years ago
Component: | Testing framework → Utilities |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Type: | Uncategorized → Cleanup/optimization |
Note:
See TracTickets
for help on using tickets.
That would change the assertion such that the test wouldn't act as a regression test for the original issue. The test would pass if the fix in 70be31bba7f8658f17235e33862319780c3dfad1 were reverted.
By the way, the 'Testing Framework' ticket component is for
django.test
issues, not for issues with Django's test suite. Use whatever component the tests are related to, or "Core (Other)" for cleanups that affect multiple test apps.