Fixed usage of several deprecated aliases in unittest.

This commit is contained in:
Alex Gaynor 2012-08-15 01:38:04 -07:00 committed by Alex Gaynor
parent d674bd603e
commit 54afdbf378
4 changed files with 23 additions and 23 deletions

View File

@ -352,7 +352,7 @@ class MultiTableInheritanceTest(TestCase):
with self.assertNumQueries(2): with self.assertNumQueries(2):
qs = BookReview.objects.prefetch_related('book') qs = BookReview.objects.prefetch_related('book')
titles = [obj.book.title for obj in qs] titles = [obj.book.title for obj in qs]
self.assertEquals(titles, ["Poems", "More poems"]) self.assertEqual(titles, ["Poems", "More poems"])
def test_m2m_to_inheriting_model(self): def test_m2m_to_inheriting_model(self):
qs = AuthorWithAge.objects.prefetch_related('books_with_year') qs = AuthorWithAge.objects.prefetch_related('books_with_year')

View File

@ -2361,7 +2361,7 @@ class AdminActionsTest(TestCase):
def test_popup_actions(self): def test_popup_actions(self):
""" Actions should not be shown in popups. """ """ Actions should not be shown in popups. """
response = self.client.get('/test_admin/admin/admin_views/subscriber/') response = self.client.get('/test_admin/admin/admin_views/subscriber/')
self.assertNotEquals(response.context["action_form"], None) self.assertNotEqual(response.context["action_form"], None)
response = self.client.get( response = self.client.get(
'/test_admin/admin/admin_views/subscriber/?%s' % IS_POPUP_VAR) '/test_admin/admin/admin_views/subscriber/?%s' % IS_POPUP_VAR)
self.assertEqual(response.context["action_form"], None) self.assertEqual(response.context["action_form"], None)

View File

@ -1513,7 +1513,7 @@ class CacheMiddlewareTest(TestCase):
# Repeating the request should result in a cache hit # Repeating the request should result in a cache hit
result = middleware.process_request(request) result = middleware.process_request(request)
self.assertNotEquals(result, None) self.assertNotEqual(result, None)
self.assertEqual(result.content, 'Hello World 1') self.assertEqual(result.content, 'Hello World 1')
# The same request through a different middleware won't hit # The same request through a different middleware won't hit
@ -1522,7 +1522,7 @@ class CacheMiddlewareTest(TestCase):
# The same request with a timeout _will_ hit # The same request with a timeout _will_ hit
result = timeout_middleware.process_request(request) result = timeout_middleware.process_request(request)
self.assertNotEquals(result, None) self.assertNotEqual(result, None)
self.assertEqual(result.content, 'Hello World 1') self.assertEqual(result.content, 'Hello World 1')
@override_settings(CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True) @override_settings(CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True)

View File

@ -2043,65 +2043,65 @@ class WhereNodeTest(TestCase):
def test_empty_full_handling_conjunction(self): def test_empty_full_handling_conjunction(self):
qn = connection.ops.quote_name qn = connection.ops.quote_name
w = WhereNode(children=[EverythingNode()]) w = WhereNode(children=[EverythingNode()])
self.assertEquals(w.as_sql(qn, connection), ('', [])) self.assertEqual(w.as_sql(qn, connection), ('', []))
w.negate() w.negate()
self.assertRaises(EmptyResultSet, w.as_sql, qn, connection) self.assertRaises(EmptyResultSet, w.as_sql, qn, connection)
w = WhereNode(children=[NothingNode()]) w = WhereNode(children=[NothingNode()])
self.assertRaises(EmptyResultSet, w.as_sql, qn, connection) self.assertRaises(EmptyResultSet, w.as_sql, qn, connection)
w.negate() w.negate()
self.assertEquals(w.as_sql(qn, connection), ('', [])) self.assertEqual(w.as_sql(qn, connection), ('', []))
w = WhereNode(children=[EverythingNode(), EverythingNode()]) w = WhereNode(children=[EverythingNode(), EverythingNode()])
self.assertEquals(w.as_sql(qn, connection), ('', [])) self.assertEqual(w.as_sql(qn, connection), ('', []))
w.negate() w.negate()
self.assertRaises(EmptyResultSet, w.as_sql, qn, connection) self.assertRaises(EmptyResultSet, w.as_sql, qn, connection)
w = WhereNode(children=[EverythingNode(), self.DummyNode()]) w = WhereNode(children=[EverythingNode(), self.DummyNode()])
self.assertEquals(w.as_sql(qn, connection), ('dummy', [])) self.assertEqual(w.as_sql(qn, connection), ('dummy', []))
w = WhereNode(children=[self.DummyNode(), self.DummyNode()]) w = WhereNode(children=[self.DummyNode(), self.DummyNode()])
self.assertEquals(w.as_sql(qn, connection), ('(dummy AND dummy)', [])) self.assertEqual(w.as_sql(qn, connection), ('(dummy AND dummy)', []))
w.negate() w.negate()
self.assertEquals(w.as_sql(qn, connection), ('NOT (dummy AND dummy)', [])) self.assertEqual(w.as_sql(qn, connection), ('NOT (dummy AND dummy)', []))
w = WhereNode(children=[NothingNode(), self.DummyNode()]) w = WhereNode(children=[NothingNode(), self.DummyNode()])
self.assertRaises(EmptyResultSet, w.as_sql, qn, connection) self.assertRaises(EmptyResultSet, w.as_sql, qn, connection)
w.negate() w.negate()
self.assertEquals(w.as_sql(qn, connection), ('', [])) self.assertEqual(w.as_sql(qn, connection), ('', []))
def test_empty_full_handling_disjunction(self): def test_empty_full_handling_disjunction(self):
qn = connection.ops.quote_name qn = connection.ops.quote_name
w = WhereNode(children=[EverythingNode()], connector='OR') w = WhereNode(children=[EverythingNode()], connector='OR')
self.assertEquals(w.as_sql(qn, connection), ('', [])) self.assertEqual(w.as_sql(qn, connection), ('', []))
w.negate() w.negate()
self.assertRaises(EmptyResultSet, w.as_sql, qn, connection) self.assertRaises(EmptyResultSet, w.as_sql, qn, connection)
w = WhereNode(children=[NothingNode()], connector='OR') w = WhereNode(children=[NothingNode()], connector='OR')
self.assertRaises(EmptyResultSet, w.as_sql, qn, connection) self.assertRaises(EmptyResultSet, w.as_sql, qn, connection)
w.negate() w.negate()
self.assertEquals(w.as_sql(qn, connection), ('', [])) self.assertEqual(w.as_sql(qn, connection), ('', []))
w = WhereNode(children=[EverythingNode(), EverythingNode()], connector='OR') w = WhereNode(children=[EverythingNode(), EverythingNode()], connector='OR')
self.assertEquals(w.as_sql(qn, connection), ('', [])) self.assertEqual(w.as_sql(qn, connection), ('', []))
w.negate() w.negate()
self.assertRaises(EmptyResultSet, w.as_sql, qn, connection) self.assertRaises(EmptyResultSet, w.as_sql, qn, connection)
w = WhereNode(children=[EverythingNode(), self.DummyNode()], connector='OR') w = WhereNode(children=[EverythingNode(), self.DummyNode()], connector='OR')
self.assertEquals(w.as_sql(qn, connection), ('', [])) self.assertEqual(w.as_sql(qn, connection), ('', []))
w.negate() w.negate()
self.assertRaises(EmptyResultSet, w.as_sql, qn, connection) self.assertRaises(EmptyResultSet, w.as_sql, qn, connection)
w = WhereNode(children=[self.DummyNode(), self.DummyNode()], connector='OR') w = WhereNode(children=[self.DummyNode(), self.DummyNode()], connector='OR')
self.assertEquals(w.as_sql(qn, connection), ('(dummy OR dummy)', [])) self.assertEqual(w.as_sql(qn, connection), ('(dummy OR dummy)', []))
w.negate() w.negate()
self.assertEquals(w.as_sql(qn, connection), ('NOT (dummy OR dummy)', [])) self.assertEqual(w.as_sql(qn, connection), ('NOT (dummy OR dummy)', []))
w = WhereNode(children=[NothingNode(), self.DummyNode()], connector='OR') w = WhereNode(children=[NothingNode(), self.DummyNode()], connector='OR')
self.assertEquals(w.as_sql(qn, connection), ('dummy', [])) self.assertEqual(w.as_sql(qn, connection), ('dummy', []))
w.negate() w.negate()
self.assertEquals(w.as_sql(qn, connection), ('NOT (dummy)', [])) self.assertEqual(w.as_sql(qn, connection), ('NOT (dummy)', []))
def test_empty_nodes(self): def test_empty_nodes(self):
qn = connection.ops.quote_name qn = connection.ops.quote_name
empty_w = WhereNode() empty_w = WhereNode()
w = WhereNode(children=[empty_w, empty_w]) w = WhereNode(children=[empty_w, empty_w])
self.assertEquals(w.as_sql(qn, connection), (None, [])) self.assertEqual(w.as_sql(qn, connection), (None, []))
w.negate() w.negate()
self.assertEquals(w.as_sql(qn, connection), (None, [])) self.assertEqual(w.as_sql(qn, connection), (None, []))
w.connector = 'OR' w.connector = 'OR'
self.assertEquals(w.as_sql(qn, connection), (None, [])) self.assertEqual(w.as_sql(qn, connection), (None, []))
w.negate() w.negate()
self.assertEquals(w.as_sql(qn, connection), (None, [])) self.assertEqual(w.as_sql(qn, connection), (None, []))
w = WhereNode(children=[empty_w, NothingNode()], connector='OR') w = WhereNode(children=[empty_w, NothingNode()], connector='OR')
self.assertRaises(EmptyResultSet, w.as_sql, qn, connection) self.assertRaises(EmptyResultSet, w.as_sql, qn, connection)