Skip to content

Commit

Permalink
use pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
ragmha committed May 5, 2024
1 parent 2ba9a14 commit d770066
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, synchronize, reopened]

jobs:
test:
jest-tests:
name: Run Jest tests
runs-on: ubuntu-latest

Expand All @@ -18,3 +18,23 @@ jobs:

- name: Run Jest tests
run: npm test -- --coverage --ci

python-tests:
name: Run Python tests
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'

- name: Install dependencies
run: pip install -r requirements.txt

- name: Run Python tests
run: pytest
26 changes: 11 additions & 15 deletions src/algorithms/arrays/is-monotonic/test_is_monotonic.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import unittest
from is_monotonic import Solution
from is_monotonic import Solution, AnotherSolution


class TestIsMonotonic(unittest.TestCase):
def test_solution_isMonotonic():
solution = Solution()
assert solution.isMonotonic([1, 2, 2, 3])
assert solution.isMonotonic([6, 5, 4, 4])
assert not solution.isMonotonic([1, 3, 2])

def setUp(self):
self.solution = Solution()

def test_isMonotonic(self):
self.assertTrue(self.solution.isMonotonic([1, 2, 2, 3]))

self.assertTrue(self.solution.isMonotonic([6, 5, 4, 4]))

self.assertFalse(self.solution.isMonotonic([1, 3, 2]))


if __name__ == '__main__':
unittest.main()
def test_another_solution_isMonotonic():
another_solution = AnotherSolution()
assert another_solution.isMonotonic([1, 2, 2, 3])
assert another_solution.isMonotonic([6, 5, 4, 4])
assert not another_solution.isMonotonic([1, 3, 2])

0 comments on commit d770066

Please sign in to comment.