summaryrefslogtreecommitdiff
path: root/tests/model_enums
diff options
context:
space:
mode:
authorNick Pope <nick@nickpope.me.uk>2021-03-23 10:07:43 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-03-24 07:45:33 +0100
commit41e39c41c9225bc3cbd5f333694e0a4d113136be (patch)
treea081eba04a533c2b6d4f8691f237f61afe869e89 /tests/model_enums
parent4894a97578dbb816f142535586b0d6154d94ac8e (diff)
downloaddjango-41e39c41c9225bc3cbd5f333694e0a4d113136be.tar.gz
Refs #32460 -- Doc'd and tested that property names of model choice enums cannot be used as members.
Diffstat (limited to 'tests/model_enums')
-rw-r--r--tests/model_enums/tests.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/model_enums/tests.py b/tests/model_enums/tests.py
index ffc199ce42..3bfec1596a 100644
--- a/tests/model_enums/tests.py
+++ b/tests/model_enums/tests.py
@@ -155,6 +155,10 @@ class ChoicesTests(SimpleTestCase):
output = template.render(Context({'Suit': Suit}))
self.assertEqual(output, 'Diamond|1')
+ def test_property_names_conflict_with_member_names(self):
+ with self.assertRaises(AttributeError):
+ models.TextChoices('Properties', 'choices labels names values')
+
class Separator(bytes, models.Choices):
FS = b'\x1c', 'File Separator'