summaryrefslogtreecommitdiff
path: root/tests/basic/tests.py
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2013-08-23 12:36:53 +0100
committerAndrew Godwin <andrew@aeracode.org>2013-08-23 12:36:53 +0100
commit5569b0b92f0504aadf0376f9cf0cb09106cd3e92 (patch)
treee82fda531a8ef41e8a32054f4fe55eb288457994 /tests/basic/tests.py
parent9cc6cfc4057e07b73a1d72a1177d568362b0c517 (diff)
parent57c82f909b212708a17edd11014be718bd02be3b (diff)
Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts: django/db/backends/oracle/base.py django/db/backends/postgresql_psycopg2/base.py django/db/models/signals.py tests/queries/tests.py
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):