[Piglit] [PATCH 39/44] options_tests.py: Fix test that happened to work on python 2

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Wed Jan 27 16:06:47 PST 2016


From: Dylan Baker <baker.dylan.c at gmail.com>

On python 2 re.compile sets no flags, so asking if the flags bitfield ==
re.IGNORECASE works. For python 3 this isn't the case (the default it
returns for me is 100010), so the test needs to correctly check that
re.IGNORECASE is in the bitfield.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 unittests/options_tests.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/unittests/options_tests.py b/unittests/options_tests.py
index c11f642..8ba13fb 100644
--- a/unittests/options_tests.py
+++ b/unittests/options_tests.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2015 Intel Corporation
+# Copyright (c) 2015-2016 Intel Corporation
 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -98,7 +98,7 @@ class TestReList(object):
 
     def test_flags(self):
         """options._ReList.__getitem__: sets flags correctly"""
-        nt.eq_(self.test[0].flags, re.IGNORECASE)
+        nt.assert_not_equal(self.test[0].flags & re.IGNORECASE, 0)
 
     def test_len(self):
         """options._ReList.len: returns expected values"""
-- 
2.7.0



More information about the Piglit mailing list