blob: 1be4c69d121289c1a5b489c355785820867d8283 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
commit 4dc0f71a2788ed3530b053c0363738a8964f6a86
author: asatarin
date: 2017-10-13T16:14:43+03:00
revision: 3199619
REVIEW:340199 Speed up StringDescription
--- contrib/python/PyHamcrest/py2/hamcrest/core/string_description.py (94523234ff338f573e50b70f8cf7f6c8456bd3a1)
+++ contrib/python/PyHamcrest/py2/hamcrest/core/string_description.py (4dc0f71a2788ed3530b053c0363738a8964f6a86)
@@ -24,15 +24,14 @@ def tostring(selfdescribing):
class StringDescription(BaseDescription):
"""A :py:class:`~hamcrest.core.description.Description` that is stored as a
string.
-
"""
def __init__(self):
- self.out = ''
+ self.__out_list = []
def __str__(self):
"""Returns the description."""
- return self.out
+ return ''.join(self.__out_list)
def append(self, string):
- self.out += six.text_type(string)
+ self.__out_list.append(six.text_type(string))
|