Skip to content

Commit

Permalink
Fixed unicode literals in Python and MOF strings
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
  • Loading branch information
andy-maier committed Jun 6, 2018
1 parent bb2a70a commit 05571bd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: pywbem
Version: 0.12.1.dev32
Version: 0.12.1.dev42
Summary: pywbem - A WBEM client
Home-page: http://pywbem.github.io/pywbem/
Author: Tim Potter
Expand Down
8 changes: 5 additions & 3 deletions pywbem_mock/_wbemconnection_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,16 @@ def _uprint(dest, text):
"""
Write text to dest, adding a newline character.
Text must be a unicode string and must not be None.
Text must be bytes or a unicode string and must not be None.
If dest is a file path, the text is encoded to a UTF-8 Byte sequence and
is appended to the file (opening and closing the file).
If dest is None, the text is encoded to a codepage suitable for the current
stdout and is written to stdout.
"""
if isinstance(text, six.binary_type):
text = text.decode('utf-8')
if dest is None:
btext = text.encode(STDOUT_ENCODING, 'replace')
if six.PY3:
Expand All @@ -109,10 +111,10 @@ def _uprint(dest, text):
else:
if six.PY2:
# Open with codecs to define text mode
with codecs.open(dest, mode='a', encoding='utf-8')as f:
with codecs.open(dest, mode='a', encoding='utf-8') as f:
print(text, file=f)
else:
with open(dest, 'a') as f:
with open(dest, 'a', encoding='utf-8') as f:
print(text, file=f)


Expand Down
Empty file modified testsuite/test_uprint.bat
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions testsuite/test_wbemconnection_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,8 @@ def test_unicode(self, conn):
cmof = u"""
class CIM_Foo {
[Key,
Description (" \u0420\u043e\u0441\u0441\u0438\u044f"
"\u00E0 voil\u00e0")]
Description ("\u212b \u0420\u043e\u0441\u0441\u0438"
"\u044f\u00E0 voil\u00e0")]
string InstanceID;
};
"""
Expand Down

0 comments on commit 05571bd

Please sign in to comment.