Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit62fe244

Browse files
add skipped tests
add tests for examples of why the current naive approach isn't sufficient
1 parentfe49677 commit62fe244

File tree

3 files changed

+73
-3
lines changed

3 files changed

+73
-3
lines changed

‎bpython/test/fodder/original.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,28 @@ def BlankLineInFunction(self):
2020
pass
2121
#EndTest
2222

23+
#StartTest-blank_line_in_try_catch
24+
try:
25+
1
26+
27+
except:
28+
2
29+
#EndTest
30+
31+
#StartTest-blank_line_in_try_catch_else
32+
try:
33+
1
34+
35+
except:
36+
2
37+
38+
else:
39+
3
40+
#EndTest
41+
42+
#StartTest-blank_trailing_line
43+
deffoo():
44+
return1
45+
46+
#EndTest
47+

‎bpython/test/fodder/processed.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,28 @@ def BlankLineInFunction(self):
1818

1919
pass
2020
#EndTest
21+
22+
#StartTest-blank_line_in_try_catch
23+
try:
24+
1
25+
26+
except:
27+
2
28+
#EndTest
29+
30+
#StartTest-blank_line_in_try_catch_else
31+
try:
32+
1
33+
34+
except:
35+
2
36+
37+
else:
38+
3
39+
#EndTest
40+
41+
#StartTest-blank_trailing_line
42+
deffoo():
43+
return1
44+
45+
#EndTest

‎bpython/test/test_preprocess.py‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
importre
66
importunittest
77

8+
try:
9+
importunittest2asunittest
10+
exceptImportError:
11+
importunittest
12+
skip=unittest.skip
13+
814
frombpython.curtsiesfrontend.interpreterimportcode_finished_will_parse
915
frombpython.curtsiesfrontend.preprocessimportindent_empty_lines
1016

@@ -34,14 +40,17 @@ def assertCompiles(self, source):
3440

3541
deftest_indent_empty_lines_nops(self):
3642
self.assertEqual(indent_empty('hello'),'hello')
43+
self.assertEqual(indent_empty('hello\ngoodbye'),'hello\ngoodbye')
44+
self.assertEqual(indent_empty('a\n b\nc\n'),'a\n b\nc\n')
3745

3846
defassertShowWhitespaceEqual(self,a,b):
47+
printa
3948
self.assertEqual(
40-
indent_empty(a),b,
49+
a,b,
4150
''.join(difflib.context_diff(a.replace(' ','~').splitlines(True),
4251
b.replace(' ','~').splitlines(True),
43-
fromfile='original',
44-
tofile='processed',
52+
fromfile='actual',
53+
tofile='expected',
4554
n=5)))
4655

4756
defassertDefinitionIndented(self,obj):
@@ -71,3 +80,14 @@ def test_empty_line_within_class(self):
7180

7281
deftest_blank_lines_in_for_loop(self):
7382
self.assertIndented('blank_lines_in_for_loop')
83+
84+
@skip("More advanced technique required: need to try compiling and backtracking")
85+
deftest_blank_line_in_try_catch(self):
86+
self.assertIndented('blank_line_in_try_catch')
87+
88+
@skip("More advanced technique required: need to try compiling and backtracking")
89+
deftest_blank_line_in_try_catch_else(self):
90+
self.assertIndented('blank_line_in_try_catch_else')
91+
92+
deftest_blank_trailing_line(self):
93+
self.assertIndented('blank_trailing_line')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp