Files
semantic-kernel/python/tests/samples/test_learn_resources.py
T
Eduard van ValkenburgandEvan Mattson 172e93113e Python: updated samples (#6411)
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
Updated samples for MS Learn, with tags.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄

---------

Co-authored-by: Evan Mattson <[email protected]>
2024-05-28 15:46:18 +00:00

90 lines
2.1 KiB
Python

# Copyright (c) Microsoft. All rights reserved.
from pytest import mark
@mark.asyncio
async def test_ai_service_sample():
from samples.learn_resources.ai_services import main
await main()
@mark.asyncio
async def test_configuring_prompts(monkeypatch):
from samples.learn_resources.configuring_prompts import main
responses = ["Hello, who are you?", "exit"]
monkeypatch.setattr("builtins.input", lambda _: responses.pop(0))
await main()
@mark.asyncio
async def test_creating_functions(monkeypatch):
from samples.learn_resources.creating_functions import main
responses = ["What is 3+3?", "exit"]
monkeypatch.setattr("builtins.input", lambda _: responses.pop(0))
await main()
@mark.asyncio
async def test_functions_within_prompts(monkeypatch):
from samples.learn_resources.functions_within_prompts import main
responses = ["Hello, who are you?", "exit"]
monkeypatch.setattr("builtins.input", lambda _: responses.pop(0))
await main()
@mark.asyncio
async def test_planner():
from samples.learn_resources.planner import main
await main()
@mark.asyncio
async def test_plugin():
from samples.learn_resources.plugin import main
await main()
@mark.asyncio
async def test_serializing_prompts(monkeypatch):
from samples.learn_resources.serializing_prompts import main
responses = ["Hello, who are you?", "exit"]
monkeypatch.setattr("builtins.input", lambda _: responses.pop(0))
await main()
@mark.asyncio
async def test_templates(monkeypatch):
from samples.learn_resources.templates import main
responses = ["Hello, who are you?", "Thanks, see you next time!"]
monkeypatch.setattr("builtins.input", lambda _: responses.pop(0))
await main()
@mark.asyncio
async def test_using_the_kernel():
from samples.learn_resources.using_the_kernel import main
await main()
@mark.asyncio
async def test_your_first_prompt(monkeypatch):
from samples.learn_resources.your_first_prompt import main
monkeypatch.setattr("builtins.input", lambda _: "I want to send an email to my manager!")
await main(delay=10)