Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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 Tim Graham, 8 years ago

Component: Testing frameworkUtilities
Resolution: invalid
Status: newclosed
Type: UncategorizedCleanup/optimization

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.

comment:2 by Chris Jerdonek, 8 years ago

Okay, sorry.

Note: See TracTickets for help on using tickets.
Back to Top