Step over yield from: test (PY-18343)

This commit is contained in:
Elizaveta Shashkova
2016-02-01 18:53:22 +03:00
parent 5b182d3988
commit 2ebcdee5f4
2 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
def generator2():
for i in range(4):
yield i
def generator():
a = 42 #breakpoint
yield from generator2()
return a
sum = 0
for i in generator():
sum += i
print("The end")

View File

@@ -725,6 +725,53 @@ public class PythonDebuggerTest extends PyEnvTestCase {
}
public void testStepOverYieldFrom() throws Exception {
runPythonTest(new PyDebuggerTask("/debug", "test_step_over_yield.py") {
@Override
protected void init() {
setMultiprocessDebug(true);
}
@Override
public void before() throws Exception {
toggleBreakpoint(getScriptPath(), 6);
}
@Override
public void testing() throws Exception {
waitForPause();
stepOver();
waitForPause();
eval("a").hasValue("42");
stepOver();
waitForPause();
eval("a").hasValue("42");
stepOver();
waitForPause();
eval("sum").hasValue("6");
resume();
}
@NotNull
@Override
public Set<String> getTags() {
return Sets.newHashSet("python34");
}
});
}
//TODO: fix me as I don't work properly sometimes (something connected with process termination on agent)
//public void testResume() throws Exception {
// runPythonTest(new PyDebuggerTask("/debug", "Test_Resume.py") {