Browse Source

Modify assert statement when comparing with None

Replace assertEqual(None, *) with assertIsNone in heat's
tests to have more clear messages in case of failure.
Also, replace assertNotEqual(None, *) with assertIsNotNone
for the same reason.

Change-Id: I34dbf9b87c7c8c6ca4949b53bd5ef763a9c2fc24
Closes-Bug: #1280522
tags/2014.1.rc1
Jia Dong 5 years ago
parent
commit
30d202ab42
2 changed files with 3 additions and 3 deletions
  1. 1
    1
      heat/tests/test_clients.py
  2. 2
    2
      heat/tests/test_engine_service.py

+ 1
- 1
heat/tests/test_clients.py View File

@@ -31,7 +31,7 @@ class ClientsTest(HeatTestCase):
31 31
         obj = clients.Clients(con)
32 32
         obj._get_client_option = mock.Mock()
33 33
         obj._get_client_option.return_value = None
34
-        self.assertEqual(None, obj._get_heat_url())
34
+        self.assertIsNone(obj._get_heat_url())
35 35
         heat_url = "http://0.0.0.0:8004/v1/%(tenant_id)s"
36 36
         obj._get_client_option.return_value = heat_url
37 37
         tenant_id = "b363706f891f48019483f8bd6503c54b"

+ 2
- 2
heat/tests/test_engine_service.py View File

@@ -908,7 +908,7 @@ class StackServiceCreateUpdateDeleteTest(HeatTestCase):
908 908
         self.assertEqual((old_stack.UPDATE, old_stack.COMPLETE),
909 909
                          old_stack.state)
910 910
         self.assertEqual(create_stack.identifier(), result)
911
-        self.assertNotEqual(None, create_stack.identifier().stack_id)
911
+        self.assertIsNotNone(create_stack.identifier().stack_id)
912 912
         self.assertEqual(create_stack.identifier().arn(),
913 913
                          old_stack['A'].properties['Foo'])
914 914
 
@@ -989,7 +989,7 @@ class StackServiceCreateUpdateDeleteTest(HeatTestCase):
989 989
         self.assertEqual((old_nested.UPDATE, old_nested.COMPLETE),
990 990
                          old_nested.state)
991 991
         self.assertEqual(create_stack.identifier(), result)
992
-        self.assertNotEqual(None, create_stack.identifier().stack_id)
992
+        self.assertIsNotNone(create_stack.identifier().stack_id)
993 993
         self.assertEqual(create_nested.identifier().arn(),
994 994
                          old_nested['A'].properties['Foo'])
995 995
 

Loading…
Cancel
Save