Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update inline tests for all cases #394

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class PythonInlineValueProvider implements InlineValuesProvider {
.map((variable: any) => variable.name);

let variableRegex = new RegExp(
'(?:self.)?' + //match self. if present
'(?:[a-zA-Z_][a-zA-Z0-9_]*\\.)*' + //match any number of variable names separated by '.'
'[a-zA-Z_][a-zA-Z0-9_]*', //math variable name
'g',
);
Expand All @@ -92,7 +92,7 @@ export class PythonInlineValueProvider implements InlineValuesProvider {
continue;
}
if (pythonVariables.includes(varName.split('.')[0])) {
if (varName.includes('self')) {
if (varName.includes('.')) {
const rng = new Range(l, match.index, l, match.index + varName.length);
allValues.push(new InlineValueEvaluatableExpression(rng, varName));
} else {
Expand Down
6 changes: 6 additions & 0 deletions src/test/pythonFiles/testAssignmentExp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
some_list = [1, 2, 3, 7]
x = 3
if (n := len(some_list)) > x:
print(f"The length of some_list is {n}, which is greater than {x}.")
else:
print(f"The length of some_list is {n}, which is not greater than {x}.")
2 changes: 2 additions & 0 deletions src/test/pythonFiles/testClassVarType.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class Person:
id = 1
def __init__(self, name, age):
self.name = name
self.age = age
Expand All @@ -8,3 +9,4 @@ def greet(self):

person1 = Person("John Doe", 30)
person1.greet()
person1.id = 3
5 changes: 2 additions & 3 deletions src/test/pythonFiles/testVarTypes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var1 = 5
var2 = 7
var1, var2 = 7, 6
var3 = "hola"
var4 = {"a": 1, "b": 2}
var5 = [1, 2, 3]
var6 =var1 + var2
var6 = var1 + var2
Loading
Loading