Skip to content

Commit ed027cf

Browse files
committed
adds ci workflow for automated testing
Sets up a GitHub Actions workflow to run tests on push and pull requests to the main branch. The workflow uses multiple Python versions to ensure compatibility across different environments.
1 parent b7b8cc2 commit ed027cf

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

.github/workflows/test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
python-version: ["3.9", "3.10", "3.11"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v4
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- run: python -m pip install --upgrade pip
24+
- run: python -m unittest discover tests

tests/test_options.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# test_options.py
2+
import unittest
3+
from screenshotmax.options import ScreenshotOptions
4+
from screenshotmax.enums import ImageFormat
5+
6+
class TestScreenshotOptions(unittest.TestCase):
7+
def test_to_dict_includes_only_non_none_values(self):
8+
options = ScreenshotOptions(
9+
url="https://example.com",
10+
format=ImageFormat.PNG,
11+
full_page=True
12+
)
13+
data = options.to_dict()
14+
self.assertEqual(data["url"], "https://example.com")
15+
self.assertEqual(data["format"], "png")
16+
self.assertEqual(data["full_page"], True)
17+
self.assertNotIn("viewport_device", data)
18+
19+
if __name__ == "__main__":
20+
unittest.main()

0 commit comments

Comments
 (0)