'Regression test for #19031'

def test_complex_override_warning(self):

    with warnings.catch_warnings(record=True) as w:
        warnings.simplefilter('always')
        with override_settings(TEST_WARN='override'):
            self.assertEqual(settings.TEST_WARN, 'override')
        self.assertEqual(len(w), 1)
        self.assertEqual(w[0].filename, __file__)
        self.assertEqual(str(w[0].message), 'Overriding    setting    TEST_WARN    can    lead    to    unexpected    behavior.')
