From 936ea9302ae72ebbca0f0669c705c9a1d747de65 Mon Sep 17 00:00:00 2001 From: Azim Khan Date: Thu, 28 Jun 2018 16:47:12 +0100 Subject: [PATCH] Strip whitespaces added by decode() function --- tests/scripts/generate_test_code.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/scripts/generate_test_code.py b/tests/scripts/generate_test_code.py index ccb2d5fe1..33da990df 100755 --- a/tests/scripts/generate_test_code.py +++ b/tests/scripts/generate_test_code.py @@ -97,8 +97,9 @@ class FileWrapper(io.FileIO): line = parent.next() # Python 2 if line: self.line_no += 1 - # Convert byte array to string with correct encoding - return line.decode(sys.getdefaultencoding()) + # Convert byte array to string with correct encoding and + # strip any whitespaces added in the decoding process. + return line.decode(sys.getdefaultencoding()).strip() + "\n" return None next = __next__