Fixed #23947 -- Django's test suite doesn't pass in reverse order

Fixed inconsistent tests when running Django's test suite with --reverse option.
if we don't use `pattern` maybe we should remove it.
Could you confirm that we don't need this on Python 3.4 (I think in IRC it was mentioned that a Python bug is fixed there). If so, please add a comment about that so we don't forget to remove it when we can.