summaryrefslogtreecommitdiff
path: root/tests/basic/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basic/tests.py')
-rw-r--r--tests/basic/tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/basic/tests.py b/tests/basic/tests.py
index 2b051621ef..611944902a 100644
--- a/tests/basic/tests.py
+++ b/tests/basic/tests.py
@@ -708,9 +708,20 @@ class ModelTest(TestCase):
SelfRef.objects.get(selfref=sr)
def test_eq(self):
+ self.assertEqual(Article(id=1), Article(id=1))
self.assertNotEqual(Article(id=1), object())
self.assertNotEqual(object(), Article(id=1))
+ a = Article()
+ self.assertEqual(a, a)
+ self.assertNotEqual(Article(), a)
+ def test_hash(self):
+ # Value based on PK
+ self.assertEqual(hash(Article(id=1)), hash(1))
+ with self.assertRaises(TypeError):
+ # No PK value -> unhashable (because save() would then change
+ # hash)
+ hash(Article())
class ConcurrentSaveTests(TransactionTestCase):