Skip to content

Commit 9ea138f

Browse files
committed
address review: move test_guido_as_bdfl_ineq_tokens()
1 parent ba5843d commit 9ea138f

2 files changed

Lines changed: 14 additions & 25 deletions

File tree

Lib/test/test_flufl.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,6 @@ def test_barry_as_bdfl_relative_import(self):
5858
self.assertEqual(cm.exception.lineno, 1)
5959
self.assertEqual(cm.exception.offset, len(code) - 4)
6060

61-
def test_guido_as_bdfl_ineq_tokens(self):
62-
code = """
63-
from io import BytesIO
64-
import tokenize
65-
from test.test_tokenize import stringify_tokens_from_source
66-
67-
s = "{0}"
68-
f = BytesIO(s.encode('utf-8'))
69-
globals()['result'] = stringify_tokens_from_source(tokenize.tokenize(f.readline), s)
70-
"""
71-
ns = {}
72-
exec(code.format('1 != 2'), ns)
73-
self.assertEqual(ns['result'],
74-
[" ENCODING 'utf-8' (0, 0) (0, 0)",
75-
" NUMBER '1' (1, 0) (1, 1)",
76-
" OP '!=' (1, 2) (1, 4)",
77-
" NUMBER '2' (1, 5) (1, 6)"])
78-
exec(code.format('1 <> 2'), ns)
79-
self.assertEqual(ns['result'],
80-
[" ENCODING 'utf-8' (0, 0) (0, 0)",
81-
" NUMBER '1' (1, 0) (1, 1)",
82-
" OP '<' (1, 2) (1, 3)",
83-
" OP '>' (1, 3) (1, 4)",
84-
" NUMBER '2' (1, 5) (1, 6)"])
85-
8661

8762
if __name__ == '__main__':
8863
unittest.main()

Lib/test/test_tokenize.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,20 @@ def test_multiline_non_ascii_fstring_with_expr(self):
12331233
FSTRING_END \'"\' (2, 2) (2, 3)
12341234
""")
12351235

1236+
def test_ineq_tokens(self):
1237+
self.check_tokenize("1 != 2", """\
1238+
NUMBER '1' (1, 0) (1, 1)
1239+
OP '!=' (1, 2) (1, 4)
1240+
NUMBER '2' (1, 5) (1, 6)
1241+
""")
1242+
self.check_tokenize("1 <> 2", """\
1243+
NUMBER '1' (1, 0) (1, 1)
1244+
OP '<' (1, 2) (1, 3)
1245+
OP '>' (1, 3) (1, 4)
1246+
NUMBER '2' (1, 5) (1, 6)
1247+
""")
1248+
1249+
12361250
class GenerateTokensTest(TokenizeTest):
12371251
def check_tokenize(self, s, expected):
12381252
# Format the tokens in s in a table format.

0 commit comments

Comments
 (0)