From de3df0f2c4a0561f9f50dc328f752966e3e8c91f Mon Sep 17 00:00:00 2001 From: lingyongxu Date: Tue, 22 Aug 2017 10:29:19 +0800 Subject: [PATCH] Using assertIsNone() instead of assertEqual(None) Following OpenStack Style Guidelines: [1] http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises [H203] Unit test assertions tend to give better messages for more specific assertions. As a result, assertIsNone(...) is preferred over assertEqual(None, ...) and assertIs(..., None) Change-Id: I6c43e4618d972c7c8b3925df6532c8b67930fdd7 --- vif_plug_ovs/tests/unit/test_linux_net.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vif_plug_ovs/tests/unit/test_linux_net.py b/vif_plug_ovs/tests/unit/test_linux_net.py index 0cf1002e..b097ca43 100644 --- a/vif_plug_ovs/tests/unit/test_linux_net.py +++ b/vif_plug_ovs/tests/unit/test_linux_net.py @@ -362,17 +362,17 @@ class LinuxNetTest(testtools.TestCase): self.assertEqual(linux_net._parse_vf_number("0"), "0") self.assertEqual(linux_net._parse_vf_number("pf13vf42"), "42") self.assertEqual(linux_net._parse_vf_number("VF19@PF13"), "19") - self.assertEqual(linux_net._parse_vf_number("p7"), None) - self.assertEqual(linux_net._parse_vf_number("pf31"), None) - self.assertEqual(linux_net._parse_vf_number("g4rbl3d"), None) + self.assertIsNone(linux_net._parse_vf_number("p7")) + self.assertIsNone(linux_net._parse_vf_number("pf31")) + self.assertIsNone(linux_net._parse_vf_number("g4rbl3d")) def test_parse_pf_number(self): - self.assertEqual(linux_net._parse_pf_number("0"), None) + self.assertIsNone(linux_net._parse_pf_number("0")) self.assertEqual(linux_net._parse_pf_number("pf13vf42"), "13") self.assertEqual(linux_net._parse_pf_number("VF19@PF13"), "13") - self.assertEqual(linux_net._parse_pf_number("p7"), None) + self.assertIsNone(linux_net._parse_pf_number("p7")) self.assertEqual(linux_net._parse_pf_number("pf31"), "31") - self.assertEqual(linux_net._parse_pf_number("g4rbl3d"), None) + self.assertIsNone(linux_net._parse_pf_number("g4rbl3d")) @mock.patch('six.moves.builtins.open') @mock.patch.object(os.path, 'isfile')