Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Integration tests improvements #186

Merged
merged 1 commit into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions fixtures/func_with_comments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# comment above
def foo(): # comment inline
pass
# comment after
73 changes: 73 additions & 0 deletions fixtures/func_with_comments.py.native
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
'PY3AST': {
'ast_type': "Module",
body: [
{
args: {
args: [],
'ast_type': "arguments",
},
'ast_type': "FunctionDef",
body: [
{
'ast_type': "Pass",
'col_offset': 5,
'end_col_offset': 9,
'end_lineno': 3,
lineno: 3,
'noops_previous': {
'ast_type': "PreviousNoops",
'col_offset': 1,
'end_col_offset': 15,
'end_lineno': 1,
lineno: 1,
lines: [
{
'ast_type': "NoopLine",
'col_offset': 1,
lineno: 1,
'noop_line': "# comment above\n",
},
],
},
},
],
'col_offset': 5,
'decorator_list': [],
'end_col_offset': 8,
'end_lineno': 2,
lineno: 2,
name: "foo",
'noops_sameline': {
'ast_type': "SameLineNoops",
'col_offset': 11,
'end_col_offset': 27,
'end_lineno': 2,
lineno: 2,
'noop_lines': [
{
'ast_type': "NoopSameLine",
s: "# comment inline",
},
],
},
returns: ~,
},
],
'noops_remainder': {
'ast_type': "RemainderNoops",
'col_offset': 1,
'end_col_offset': 1,
'end_lineno': 4,
lineno: 4,
lines: [
{
'ast_type': "NoopLine",
'col_offset': 1,
lineno: 4,
'noop_line': "# comment after\n",
},
],
},
},
}
150 changes: 150 additions & 0 deletions fixtures/func_with_comments.py.sem.uast
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{ '@type': "python:Module",
'@role': [File, Module],
'@pos': { '@type': "uast:Positions",
},
body: [
{ '@type': "uast:FunctionGroup",
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 20,
line: 2,
col: 5,
},
end: { '@type': "uast:Position",
offset: 23,
line: 2,
col: 8,
},
},
Nodes: [
{
async: false,
comments: {
'noops_sameline': { '@type': "python:SameLineNoops",
'@role': [Comment],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 26,
line: 2,
col: 11,
},
end: { '@type': "uast:Position",
offset: 42,
line: 2,
col: 27,
},
},
'noop_lines': [
{ '@type': "uast:Comment",
'@pos': { '@type': "uast:Positions",
},
Block: false,
Prefix: " ",
Suffix: "",
Tab: "",
Text: "comment inline",
},
],
},
},
decorators: [],
},
{ '@type': "uast:Alias",
Name: { '@type': "uast:Identifier",
Name: "foo",
},
Node: { '@type': "uast:Function",
Body: { '@type': "uast:Block",
Statements: [
{ '@type': "python:Pass",
'@token': "pass",
'@role': [Noop, Statement],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 48,
line: 3,
col: 5,
},
end: { '@type': "uast:Position",
offset: 52,
line: 3,
col: 9,
},
},
'noops_previous': { '@type': "python:PreviousNoops",
'@role': [Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 0,
line: 1,
col: 1,
},
end: { '@type': "uast:Position",
offset: 14,
line: 1,
col: 15,
},
},
lines: [
{ '@type': "uast:Comment",
'@role': [Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 0,
line: 1,
col: 1,
},
},
Block: false,
Prefix: " ",
Suffix: "\n",
Tab: "",
Text: "comment above",
},
],
},
},
],
},
Type: { '@type': "uast:FunctionType",
Arguments: [],
Returns: ~,
},
},
},
],
},
],
'noops_remainder': { '@type': "python:RemainderNoops",
'@role': [Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 53,
line: 4,
col: 1,
},
end: { '@type': "uast:Position",
offset: 53,
line: 4,
col: 1,
},
},
lines: [
{ '@type': "uast:Comment",
'@role': [Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 53,
line: 4,
col: 1,
},
},
Block: false,
Prefix: " ",
Suffix: "\n",
Tab: "",
Text: "comment after",
},
],
},
}
134 changes: 134 additions & 0 deletions fixtures/func_with_comments.py.uast
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{ '@type': "Module",
'@role': [File, Module],
'@pos': { '@type': "uast:Positions",
},
body: [
{ '@type': "FunctionDef",
'@token': "foo",
'@role': [Declaration, Function, Identifier, Name],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 20,
line: 2,
col: 5,
},
end: { '@type': "uast:Position",
offset: 23,
line: 2,
col: 8,
},
},
args: { '@type': "arguments",
'@role': [Argument, Declaration, Function, Incomplete],
'@pos': { '@type': "uast:Positions",
},
args: [],
},
body: { '@type': "FunctionDef.body",
'@role': [Body, Declaration, Function],
'body_stmts': [
{ '@type': "Pass",
'@token': "pass",
'@role': [Noop, Statement],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 48,
line: 3,
col: 5,
},
end: { '@type': "uast:Position",
offset: 52,
line: 3,
col: 9,
},
},
'noops_previous': { '@type': "PreviousNoops",
'@role': [Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 0,
line: 1,
col: 1,
},
end: { '@type': "uast:Position",
offset: 14,
line: 1,
col: 15,
},
},
lines: [
{ '@type': "NoopLine",
'@token': "# comment above\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 0,
line: 1,
col: 1,
},
},
},
],
},
},
],
},
'decorator_list': { '@type': "FunctionDef.decorators",
'@role': [Declaration, Function, Incomplete],
decorators: [],
},
'noops_sameline': { '@type': "SameLineNoops",
'@role': [Comment],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 26,
line: 2,
col: 11,
},
end: { '@type': "uast:Position",
offset: 42,
line: 2,
col: 27,
},
},
'noop_lines': [
{ '@type': "NoopSameLine",
'@token': "# comment inline",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
},
},
],
},
returns: ~,
},
],
'noops_remainder': { '@type': "RemainderNoops",
'@role': [Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 53,
line: 4,
col: 1,
},
end: { '@type': "uast:Position",
offset: 53,
line: 4,
col: 1,
},
},
lines: [
{ '@type': "NoopLine",
'@token': "# comment after\n",
'@role': [Comment, Noop],
'@pos': { '@type': "uast:Positions",
start: { '@type': "uast:Position",
offset: 53,
line: 4,
col: 1,
},
},
},
],
},
}
2 changes: 2 additions & 0 deletions fixtures/issue177.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def testfnc1(**options):
print "force python2"
Loading