Browse Source

Replace assertEqual(True/False, *) with assertTrue/assertFalse in tests

In UT Test,It provides assertTrue(*) and assertFalse(*) to check the
returned value. It is not necessary to use assertEqual(True, *) or
assertEqual(False, *)

Change-Id: I335e5f542861c31ee5fa75953926e97701e50c77
Story: #2003776
Task: #26469
Tao Li 7 months ago
parent
commit
d13d8144bb
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      ironic_inspector/test/unit/test_dnsmasq_pxe_filter.py

+ 3
- 3
ironic_inspector/test/unit/test_dnsmasq_pxe_filter.py View File

@@ -126,7 +126,7 @@ class TestExclusiveWriteOrPass(test_base.BaseTest):
126 126
 
127 127
     def test_write(self):
128 128
         wrote = dnsmasq._exclusive_write_or_pass(self.path, self.buf)
129
-        self.assertEqual(True, wrote)
129
+        self.assertTrue(wrote)
130 130
         self.mock_open.assert_called_once_with(self.path, 'w', 1)
131 131
         self.mock_fcntl.assert_has_calls(
132 132
             [self.fcntl_lock_call, self.fcntl_unlock_call])
@@ -144,7 +144,7 @@ class TestExclusiveWriteOrPass(test_base.BaseTest):
144 144
             None, None]
145 145
         wrote = dnsmasq._exclusive_write_or_pass(self.path, self.buf)
146 146
 
147
-        self.assertEqual(True, wrote)
147
+        self.assertTrue(wrote)
148 148
         self.mock_open.assert_called_once_with(self.path, 'w', 1)
149 149
         self.mock_fcntl.assert_has_calls(
150 150
             [self.fcntl_lock_call, self.fcntl_unlock_call],
@@ -164,7 +164,7 @@ class TestExclusiveWriteOrPass(test_base.BaseTest):
164 164
         self.mock_fcntl.side_effect = [err, None]
165 165
 
166 166
         wrote = dnsmasq._exclusive_write_or_pass(self.path, self.buf)
167
-        self.assertEqual(False, wrote)
167
+        self.assertFalse(wrote)
168 168
         self.mock_open.assert_called_once_with(self.path, 'w', 1)
169 169
         self.mock_fcntl.assert_has_calls(
170 170
             [self.fcntl_lock_call, self.fcntl_unlock_call])

Loading…
Cancel
Save