Skip to content

Commit

Permalink
Move DBRef hash test to the right module.
Browse files Browse the repository at this point in the history
  • Loading branch information
behackett committed Apr 5, 2011
1 parent d87ed76 commit f11a1cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 0 additions & 13 deletions test/test_bson.py
Expand Up @@ -346,18 +346,5 @@ def test_ordered_dict(self):
d = OrderedDict([("one", 1), ("two", 2), ("three", 3), ("four", 4)])
self.assertEqual(d, BSON.encode(d).decode(as_class=OrderedDict))

def test_dbref_hash(self):
dbref_1a = DBRef('collection', 'id', 'database')
dbref_1b = DBRef('collection', 'id', 'database')
self.assertEquals(hash(dbref_1a), hash(dbref_1b))

dbref_2a = DBRef('collection', 'id', 'database', custom='custom')
dbref_2b = DBRef('collection', 'id', 'database', custom='custom')
self.assertEquals(hash(dbref_2a), hash(dbref_2b))

self.assertNotEqual(hash(dbref_1a), hash(dbref_2a))



if __name__ == "__main__":
unittest.main()
11 changes: 11 additions & 0 deletions test/test_dbref.py
Expand Up @@ -112,5 +112,16 @@ def test_pickling(self):
dbr2 = pickle.loads(pkl)
self.assertEqual(dbr, dbr2)

def test_dbref_hash(self):
dbref_1a = DBRef('collection', 'id', 'database')
dbref_1b = DBRef('collection', 'id', 'database')
self.assertEquals(hash(dbref_1a), hash(dbref_1b))

dbref_2a = DBRef('collection', 'id', 'database', custom='custom')
dbref_2b = DBRef('collection', 'id', 'database', custom='custom')
self.assertEquals(hash(dbref_2a), hash(dbref_2b))

self.assertNotEqual(hash(dbref_1a), hash(dbref_2a))

if __name__ == "__main__":
unittest.main()

0 comments on commit f11a1cb

Please sign in to comment.