diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2012-07-24 07:01:57 -0700 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2012-07-24 07:01:57 -0700 |
| commit | 38ce709fe44ebf37e6c8531451eab98fe0a552a0 (patch) | |
| tree | 8c8b0038171d3e75393cd8d7c042b7c5a10b0eaa /tests | |
| parent | ae4125ffce6c0a82e9016f67d60d31bc7595887c (diff) | |
Added tests for deprecation warnings and fixed the argument order for the warnings.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/utils/datastructures.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/regressiontests/utils/datastructures.py b/tests/regressiontests/utils/datastructures.py index 08bcd7157a..aea5393aab 100644 --- a/tests/regressiontests/utils/datastructures.py +++ b/tests/regressiontests/utils/datastructures.py @@ -4,6 +4,7 @@ Tests for stuff in django.utils.datastructures. import copy import pickle +import warnings from django.test import SimpleTestCase from django.utils.datastructures import (DictWrapper, ImmutableList, @@ -122,6 +123,21 @@ class SortedDictTests(SimpleTestCase): self.assertEqual(self.d1, {}) self.assertEqual(self.d1.keyOrder, []) + def test_insert(self): + d = SortedDict() + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + d.insert(0, "hello", "world") + assert w[0].category is PendingDeprecationWarning + + def test_value_for_index(self): + d = SortedDict({"a": 3}) + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + self.assertEqual(d.value_for_index(0), 3) + assert w[0].category is PendingDeprecationWarning + + class MergeDictTests(SimpleTestCase): def test_simple_mergedict(self): |
