diff options
author | Armin Rigo <arigo@tunes.org> | 2014-06-07 08:47:56 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2014-06-07 08:47:56 +0200 |
commit | 7ea7356e8772a42d5ddbf20ad569b363fb74688a (patch) | |
tree | 91c16047c67cf96922a4ba611f5a88c2ac56b472 /rpython/rlib/test/test_rstring.py | |
parent | A branch to improve the performance of StringBuilder (diff) | |
download | pypy-7ea7356e8772a42d5ddbf20ad569b363fb74688a.tar.gz pypy-7ea7356e8772a42d5ddbf20ad569b363fb74688a.tar.bz2 pypy-7ea7356e8772a42d5ddbf20ad569b363fb74688a.zip |
Start by changing the pure-Python implementation so that it
raises if it is used again after build().
Diffstat (limited to 'rpython/rlib/test/test_rstring.py')
-rw-r--r-- | rpython/rlib/test/test_rstring.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/rpython/rlib/test/test_rstring.py b/rpython/rlib/test/test_rstring.py index ccdbbdf2d6..0d2479564c 100644 --- a/rpython/rlib/test/test_rstring.py +++ b/rpython/rlib/test/test_rstring.py @@ -160,7 +160,10 @@ def test_string_builder(): s.append("a") s.append_slice("abc", 1, 2) s.append_multiple_char('d', 4) - assert s.build() == "aabcabdddd" + result = s.build() + assert result == "aabcabdddd" + py.test.raises(AttributeError, s.build) + py.test.raises(AttributeError, s.append, "x") def test_unicode_builder(): s = UnicodeBuilder() @@ -169,8 +172,9 @@ def test_unicode_builder(): s.append_slice(u'abcdef', 1, 2) assert s.getlength() == len('aabcb') s.append_multiple_char(u'd', 4) - assert s.build() == 'aabcbdddd' - assert isinstance(s.build(), unicode) + result = s.build() + assert result == 'aabcbdddd' + assert isinstance(result, unicode) class TestTranslates(BaseRtypingTest): |