Skip to content

Commit 1ca1fe4

Browse files
author
Inbar Rose
committed
pep 8 docstrings
1 parent 898e5ef commit 1ca1fe4

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

junit_xml/__init__.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555

5656

5757
def decode(var, encoding):
58-
'''
58+
"""
5959
If not already unicode, decode it.
60-
'''
60+
"""
6161
if PY2:
6262
if isinstance(var, unicode):
6363
ret = var
@@ -74,9 +74,10 @@ def decode(var, encoding):
7474

7575

7676
class TestSuite(object):
77-
'''Suite of test cases.
77+
"""
78+
Suite of test cases.
7879
Can handle unicode strings or binary strings if their encoding is provided.
79-
'''
80+
"""
8081

8182
def __init__(self, name, test_cases=None, hostname=None, id=None,
8283
package=None, timestamp=None, properties=None):
@@ -94,14 +95,13 @@ def __init__(self, name, test_cases=None, hostname=None, id=None,
9495
self.timestamp = timestamp
9596
self.properties = properties
9697

97-
9898
def build_xml_doc(self, encoding=None):
99-
'''
99+
"""
100100
Builds the XML document for the JUnit test suite.
101101
Produces clean unicode strings and decodes non-unicode with the help of encoding.
102102
@param encoding: Used to decode encoded strings.
103103
@return: XML document with unicode string elements
104-
'''
104+
"""
105105

106106
# build the test suite element
107107
test_suite_attributes = dict()
@@ -192,10 +192,11 @@ def build_xml_doc(self, encoding=None):
192192

193193
@staticmethod
194194
def to_xml_string(test_suites, prettyprint=True, encoding=None):
195-
'''Returns the string representation of the JUnit XML document.
195+
"""
196+
Returns the string representation of the JUnit XML document.
196197
@param encoding: The encoding of the input.
197198
@return: unicode string
198-
'''
199+
"""
199200

200201
try:
201202
iter(test_suites)
@@ -233,22 +234,21 @@ def to_xml_string(test_suites, prettyprint=True, encoding=None):
233234

234235
@staticmethod
235236
def to_file(file_descriptor, test_suites, prettyprint=True, encoding=None):
236-
'''
237+
"""
237238
Writes the JUnit XML document to a file.
238-
'''
239+
"""
239240
xml_string = TestSuite.to_xml_string(
240241
test_suites, prettyprint=prettyprint, encoding=encoding)
241242
# has problems with encoded str with non-ASCII (non-default-encoding) characters!
242243
file_descriptor.write(xml_string)
243244

244-
245245
@staticmethod
246246
def _clean_illegal_xml_chars(string_to_clean):
247-
'''
247+
"""
248248
Removes any illegal unicode characters from the given XML string.
249249
250250
@see: http://stackoverflow.com/questions/1707890/fast-way-to-filter-illegal-xml-unicode-chars-in-python
251-
'''
251+
"""
252252

253253
illegal_unichrs = [
254254
(0x00, 0x08), (0x0B, 0x1F), (0x7F, 0x84), (0x86, 0x9F),

0 commit comments

Comments
 (0)