From 13b81b5d9cca1fe1bafe18734edb90717eb771da Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 24 Sep 2019 14:17:38 -0400 Subject: [PATCH] bt2: ignore comparison to None flake8 warnings in test_value.py Fix these: ./tests/bindings/python/bt2/test_value.py:485:36: E711 comparison to None should be 'if cond is None:' ./tests/bindings/python/bt2/test_value.py:488:35: E711 comparison to None should be 'if cond is not None:' ./tests/bindings/python/bt2/test_value.py:1177:36: E711 comparison to None should be 'if cond is None:' ./tests/bindings/python/bt2/test_value.py:1180:35: E711 comparison to None should be 'if cond is not None:' In these tests, we specifically want to test that comparing (equal/not equal) to None yields the expected result. Reported-by: flake8 Change-Id: I47d96598a158b10116fc6a948d42ef61f608fb07 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/2087 --- tests/bindings/python/bt2/test_value.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/bindings/python/bt2/test_value.py b/tests/bindings/python/bt2/test_value.py index 87f624b2..c7cfe014 100644 --- a/tests/bindings/python/bt2/test_value.py +++ b/tests/bindings/python/bt2/test_value.py @@ -482,10 +482,14 @@ class _TestNumericValue(_TestCopySimple): self.assertEqual(str(self._def), str(self._def_value)) def test_eq_none(self): - self.assertFalse(self._def == None) + # Disable the "comparison to None" warning, as this is precisely what + # we want to test here. + self.assertFalse(self._def == None) # noqa: E711 def test_ne_none(self): - self.assertTrue(self._def != None) + # Disable the "comparison to None" warning, as this is precisely what + # we want to test here. + self.assertTrue(self._def != None) # noqa: E711 # This is a list of binary operators used for @@ -1174,10 +1178,14 @@ class BoolValueTestCase(_TestNumericValue, unittest.TestCase): self.assertEqual(str(self._def), str(self._def_value)) def test_eq_none(self): - self.assertFalse(self._def == None) + # Disable the "comparison to None" warning, as this is precisely what + # we want to test here. + self.assertFalse(self._def == None) # noqa: E711 def test_ne_none(self): - self.assertTrue(self._def != None) + # Disable the "comparison to None" warning, as this is precisely what + # we want to test here. + self.assertTrue(self._def != None) # noqa: E711 def test_vfalse_eq_false(self): self.assertEqual(self._f, False) -- 2.34.1