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 4acf428 commit 4436fac
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
run: pip install -r requirements.txt

- name: Run Python tests
run: python -m unittest discover -p 'test_*.py' -v
run: pytest
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
Binary file not shown.
32 changes: 10 additions & 22 deletions src/algorithms/arrays/is-monotonic/test_is_monotonic.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
import unittest
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()
self.another_solution = AnotherSolution()

def test_solution_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]))

def test_another_solution_isMonotonic(self):
self.assertTrue(self.another_solution.isMonotonic([1, 2, 2, 3]))

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

self.assertFalse(self.another_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 4436fac

Please sign in to comment.