mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-03-04 13:15:55 +08:00
28 lines
369 B
Plaintext
28 lines
369 B
Plaintext
|
|
from io import File
|
|
from path import join, dirname
|
|
|
|
FILE_PATH = join(dirname(__file__), 'test_file.txt')
|
|
|
|
def read_file()
|
|
f = open(FILE_PATH)
|
|
|
|
assert(f is File)
|
|
|
|
LINES = [
|
|
'line1 : foo\n',
|
|
'line2 : bar\n',
|
|
'line3 : baz\n',
|
|
'line4 : qux\n',
|
|
]
|
|
|
|
line = ''
|
|
while line = f.getline()
|
|
assert(line in LINES)
|
|
end
|
|
|
|
f.close()
|
|
end
|
|
|
|
read_file()
|