def test_stream_content_reset(self): detail_name = 'test' fixture = StringStream(detail_name) with fixture: stream = fixture.stream content = fixture.getDetails()[detail_name] stream.write(_u("testing 1 2 3")) with fixture: # The old content object returns the old usage self.assertEqual(_u("testing 1 2 3"), content.as_text()) content = fixture.getDetails()[detail_name] # A new fixture returns the new output: stream = fixture.stream stream.write(_u("1 2 3 testing")) self.assertEqual(_u("1 2 3 testing"), content.as_text())
def test_stream_content_in_details(self): detail_name = 'test' fixture = StringStream(detail_name) with fixture: stream = fixture.stream content = fixture.getDetails()[detail_name] # Output after getDetails is called is included. stream.write(_u("testing 1 2 3")) self.assertEqual("testing 1 2 3", content.as_text())
def test_empty_detail_stream(self): detail_name = 'test' fixture = StringStream(detail_name) with fixture: content = fixture.getDetails()[detail_name] self.assertEqual(_u(""), content.as_text())