<s> import google3 <EOL> from grizzled . io import * <EOL> from cStringIO import StringIO <EOL> import os <EOL> import tempfile <EOL> import atexit <EOL> class TestPushback ( object ) : <EOL> def testPushback ( self ) : <EOL> inputString = """<STR_LIT>""" <EOL> f = StringIO ( inputString ) <EOL> pb = PushbackFile ( f ) <EOL> s = pb . readline ( ) <EOL> print s <EOL> assert s == '<STR_LIT>' <EOL> pb . pushback ( s ) <EOL> s = pb . readline ( ) <EOL> print s <EOL> assert s == '<STR_LIT>' <EOL> s = pb . read ( <NUM_LIT:1> ) <EOL> print s <EOL> assert s == '<STR_LIT:d>' <EOL> s = pb . readline ( ) <EOL> print s <EOL> assert s == '<STR_LIT>' <EOL> s = pb . read ( - <NUM_LIT:1> ) <EOL> print s <EOL> assert s == '<STR_LIT>' <EOL> s = pb . readline ( ) <EOL> assert s == '<STR_LIT>' <EOL> pb . pushback ( '<STR_LIT>' ) <EOL> s = pb . readline ( ) <EOL> print s <EOL> assert s == '<STR_LIT>' </s>
