From 0846483714b5f94bd8f346333479a32b39c90e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomulik?= Date: Fri, 5 Oct 2018 14:35:41 +0200 Subject: fixed bugs in must_[not_]_contain() --- src/CHANGES.txt | 3 +++ testing/framework/TestCommon.py | 11 +++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6359560..72ba123 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 3.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Paweł Tomulik: + - Fixed must_contain() and must_not_contain() to work with substrings + located at zero offset in a file. From Daniel Moody: - Updated FS.py to handle removal of splitunc function from python 3.7 diff --git a/testing/framework/TestCommon.py b/testing/framework/TestCommon.py index e55b491..53c0388 100644 --- a/testing/framework/TestCommon.py +++ b/testing/framework/TestCommon.py @@ -292,14 +292,13 @@ class TestCommon(TestCmd): return o.index(l) except ValueError: return None - contains = find(file_contents, required) - if not contains: + if find(file_contents, required) is None: print("File `%s' does not contain required string." % file) print(self.banner('Required string ')) print(required) print(self.banner('%s contents ' % file)) print(file_contents) - self.fail_test(not contains) + self.fail_test() def must_contain_all(self, output, input, title=None, find=None): """Ensures that the specified output string (first argument) @@ -514,14 +513,14 @@ class TestCommon(TestCmd): return o.index(l) except ValueError: return None - contains = find(file_contents, banned) - if contains: + + if find(file_contents, banned) is not None: print("File `%s' contains banned string." % file) print(self.banner('Banned string ')) print(banned) print(self.banner('%s contents ' % file)) print(file_contents) - self.fail_test(contains) + self.fail_test() def must_not_contain_any_line(self, output, lines, title=None, find=None): """Ensures that the specified output string (first argument) -- cgit v0.12