WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit f2a9fa60 authored by John Zhang's avatar John Zhang
Browse files

open_file_as_stream test

parent a9cfbbe5
......@@ -1463,6 +1463,39 @@ Running test DoesNotUnderstandTest
assert res.out == expected_out
def test_open_file_as_stream():
from rpython.rlib.streamio import open_file_as_stream
john1 = \
In the beginning was the Word, and the Word was with God, and the Word was God.
He was in the beginning with God.
All things were made through him, and without him was not any thing made that was made.
In him was life, and the life was the light of men.
The light shines in the darkness, and the darkness has not overcome it.
test_file = py.path.local('/tmp/john1.txt')
with test_file.open('w') as fp:
def entry_point(argv):
f = open_file_as_stream(argv[1])
txt = ""
l = f.readline()
while l != '':
txt += l
l = f.readline()
print txt
return 0
res = run_boot_image(entry_point, '/tmp/test_open_file_as_stream', args=[str(test_file)])
assert res.returncode == 0, res.err
assert res.out == john1 + '\n'
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment