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 7, 2018
1 parent bb2a70a commit 63871ab
Show file tree
Hide file tree
Showing 4 changed files with 7 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
7 changes: 4 additions & 3 deletions pywbem_mock/_wbemconnection_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def _uprint(dest, text):
If dest is None, the text is encoded to a codepage suitable for the current
stdout and is written to stdout.
"""
assert isinstance(text, six.text_type)
if dest is None:
btext = text.encode(STDOUT_ENCODING, 'replace')
if six.PY3:
Expand All @@ -109,10 +110,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 Expand Up @@ -795,7 +796,7 @@ def display_repository(self, namespaces=None, dest=None, summary=False,
repo_nss = sorted(repo_nss)

for ns in repo_nss:
_uprint(dest, '\n%sNAMESPACE %s%s\n' % (cmt_begin, ns, cmt_end))
_uprint(dest, u'\n%sNAMESPACE %s%s\n' % (cmt_begin, ns, cmt_end))
self._display_objects('Qualifier Declarations', self.qualifiers,
ns, cmt_begin, cmt_end, dest=dest,
summary=summary, output_format=output_format)
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 63871ab

Please sign in to comment.