Skip to content

Commit

Permalink
Add yield unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
louislefevre committed Aug 29, 2021
1 parent e47fc2d commit 883847e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,20 @@ describe('Execute Python Commands', () => {
expect(output).toBe('0\n1\n2');
});

test('Execute_YieldCommand_ReturnResult', async () => {
let input = dedent`
def test():
yield 0
yield 1
yield 2
for i in test():
print(i)
`;
let output = await python.execute(input);
expect(output).toBe('0\n1\n2');
});

test('Execute_FunctionCommand_ReturnResult', async () => {
let input = dedent`
def test(x):
Expand Down

0 comments on commit 883847e

Please sign in to comment.