Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
tonybaloney committed Nov 14, 2024
1 parent 9cf18b4 commit a5af133
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Integration.Tests/GeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,15 @@ public void TestNormalGenerator()
var generator = mod.TestNormalGenerator();
Assert.Equal<string[]>(["one", "two"], generator.ToArray());
}

[Fact]
public async Task TestAsyncEnumerator()
{
var mod = Env.TestGenerators();
List<string> words = [ "foo", "bar", "baz"];
await foreach (string word in mod.TestGeneratorSequence())
{
Assert.Contains(word, words);
}
}
}
7 changes: 7 additions & 0 deletions src/Integration.Tests/python/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ def example_generator(length: int) -> Generator[str, int, bool]:

return True


def test_normal_generator() -> Generator[str, None, None]:
yield "one"
yield "two"


def test_generator_sequence() -> Generator[str, None, None]:
words = ["foo", "bar", "baz"]
for word in words:
yield word

0 comments on commit a5af133

Please sign in to comment.