summaryrefslogtreecommitdiff
path: root/tests/basics/io_stringio_base.py
blob: c8890dab73ab71b0299d3b6b7c73c2e3131e2eab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Checks that an instance type inheriting from a native base that uses
# MP_TYPE_FLAG_ITER_IS_STREAM will still have a getiter.

try:
    import io
except ImportError:
    print("SKIP")
    raise SystemExit

a = io.StringIO()
a.write("hello\nworld\nmicro\npython\n")
a.seek(0)

for line in a:
    print(line)

class X(io.StringIO):
    pass

b = X()
b.write("hello\nworld\nmicro\npython\n")
b.seek(0)

for line in b:
    print(line)