diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8e66aba --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.8] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + - name: Run tests + run: | + pytest diff --git a/README.md b/README.md index b6a0f98..8192178 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # GitHub Copilot: Your AI-Powered Coding Partner +[![Build Status](https://github.com/MattUebel/copilot-presentation/actions/workflows/ci.yml/badge.svg)](https://github.com/MattUebel/copilot-presentation/actions) + Welcome to the staging area for materials related to the talk, **"GitHub Copilot: Your AI-Powered Coding Partner."** This repository serves as a central hub for content, resources, and links that will help you understand and utilize GitHub Copilot in your coding workflows. ## Overview diff --git a/tests/test_example1.py b/tests/test_example1.py new file mode 100644 index 0000000..7d6a16c --- /dev/null +++ b/tests/test_example1.py @@ -0,0 +1,25 @@ +import pytest +from presentation.examples.example1 import add, subtract, multiply, divide + +def test_add(): + assert add(2, 3) == 5 + assert add(-1, 1) == 0 + assert add(0, 0) == 0 + +def test_subtract(): + assert subtract(5, 3) == 2 + assert subtract(0, 1) == -1 + assert subtract(-1, -1) == 0 + +def test_multiply(): + assert multiply(2, 3) == 6 + assert multiply(-1, 1) == -1 + assert multiply(0, 100) == 0 + +def test_divide(): + assert divide(6, 3) == 2 + assert divide(-4, 2) == -2 + assert divide(5, 2) == 2.5 + + with pytest.raises(ValueError): + divide(10, 0) diff --git a/tests/test_example2.py b/tests/test_example2.py new file mode 100644 index 0000000..4ee9c11 --- /dev/null +++ b/tests/test_example2.py @@ -0,0 +1,17 @@ +import unittest +from presentation.examples.example2 import greet, farewell + +class TestExample2(unittest.TestCase): + + def test_greet(self): + self.assertEqual(greet("Alice"), "Hello, Alice!") + self.assertEqual(greet("Bob"), "Hello, Bob!") + self.assertEqual(greet(""), "Hello, !") + + def test_farewell(self): + self.assertEqual(farewell("Alice"), "Goodbye, Alice!") + self.assertEqual(farewell("Bob"), "Goodbye, Bob!") + self.assertEqual(farewell(""), "Goodbye, !") + +if __name__ == '__main__': + unittest.main()