Browse Source

Replace assertEqual(None, *) with assertIsNone

Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.

Closes-Bug:#1280522
Change-Id: Ib7a24bf7443d9c49e42119c649a32a1e8bd20ba1
tags/0.1.0
xxj 2 years ago
parent
commit
afe2b6fa12
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      zun/tests/unit/api/controllers/test_types.py

+ 8
- 8
zun/tests/unit/api/controllers/test_types.py View File

@@ -19,14 +19,14 @@ from zun.tests import base as test_base
19 19
 class TestTypes(test_base.BaseTestCase):
20 20
 
21 21
     def test_text(self):
22
-        self.assertEqual(None, types.Text.validate(None))
22
+        self.assertIsNone(types.Text.validate(None))
23 23
 
24 24
         self.assertEqual('test_value', types.Text.validate('test_value'))
25 25
         self.assertRaises(exception.InvalidValue,
26 26
                           types.Text.validate, 1)
27 27
 
28 28
     def test_string_type(self):
29
-        self.assertEqual(None, types.String.validate(None))
29
+        self.assertIsNone(types.String.validate(None))
30 30
 
31 31
         test_value = 'test_value'
32 32
         self.assertEqual(test_value, types.String.validate(test_value))
@@ -52,7 +52,7 @@ class TestTypes(test_base.BaseTestCase):
52 52
                 test_value, max_length=i))
53 53
 
54 54
     def test_integer_type(self):
55
-        self.assertEqual(None, types.Integer.validate(None))
55
+        self.assertIsNone(types.Integer.validate(None))
56 56
 
57 57
         test_value = 10
58 58
         self.assertEqual(test_value, types.Integer.validate(test_value))
@@ -81,7 +81,7 @@ class TestTypes(test_base.BaseTestCase):
81 81
                 test_value, maximum=i))
82 82
 
83 83
     def test_port_type(self):
84
-        self.assertEqual(None, types.Integer.validate(None))
84
+        self.assertIsNone(types.Integer.validate(None))
85 85
 
86 86
         self.assertEqual(1, types.Port.validate('1'))
87 87
         self.assertEqual(80, types.Port.validate('80'))
@@ -94,7 +94,7 @@ class TestTypes(test_base.BaseTestCase):
94 94
                           types.Port.validate, '65536')
95 95
 
96 96
     def test_float_type(self):
97
-        self.assertEqual(None, types.Float.validate(None))
97
+        self.assertIsNone(types.Float.validate(None))
98 98
 
99 99
         self.assertEqual(0.5, types.Float.validate('0.5'))
100 100
         self.assertEqual(1.0, types.Float.validate('1'))
@@ -128,7 +128,7 @@ class TestTypes(test_base.BaseTestCase):
128 128
             }
129 129
 
130 130
         test_type = types.Custom(TestAPI)
131
-        self.assertEqual(None, test_type.validate(None))
131
+        self.assertIsNone(test_type.validate(None))
132 132
 
133 133
         value = TestAPI(test='test_value')
134 134
         value = test_type.validate(value)
@@ -146,7 +146,7 @@ class TestTypes(test_base.BaseTestCase):
146 146
 
147 147
     def test_list_with_text_type(self):
148 148
         list_type = types.List(types.Text)
149
-        self.assertEqual(None, list_type.validate(None))
149
+        self.assertIsNone(list_type.validate(None))
150 150
 
151 151
         value = list_type.validate(['test1', 'test2'])
152 152
         self.assertEqual(['test1', 'test2'], value)
@@ -164,7 +164,7 @@ class TestTypes(test_base.BaseTestCase):
164 164
             }
165 165
 
166 166
         list_type = types.List(types.Custom(TestAPI))
167
-        self.assertEqual(None, list_type.validate(None))
167
+        self.assertIsNone(list_type.validate(None))
168 168
 
169 169
         value = [{'test': 'test_value'}]
170 170
         value = list_type.validate(value)

Loading…
Cancel
Save