Skip to content

Commit 7588add

Browse files
authored
Merge pull request #59 from Python-World/STOOL2
upgraded python version 3.11
2 parents 6685a55 + c84dfb2 commit 7588add

9 files changed

+40
-63
lines changed

.pre-commit-config.yaml

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22

33
- repo: https://github.com/pycqa/isort
4-
rev: 5.8.0
4+
rev: 5.12.0
55
hooks:
66
- id: isort
77
name: isort (python)
@@ -11,27 +11,16 @@ repos:
1111
- id: isort
1212
name: isort (pyi)
1313
types: [pyi]
14-
15-
- repo: https://github.com/psf/black
16-
rev: 20.8b1
17-
hooks:
18-
- id: black
19-
language_version: python3
20-
entry: black . --check
21-
22-
- repo: https://github.com/pre-commit/mirrors-mypy
23-
rev: v0.812
24-
hooks:
25-
- id: mypy
2614

2715
- repo: https://github.com/igorshubovych/markdownlint-cli
28-
rev: v0.27.1
16+
rev: v0.34.0
2917
hooks:
3018
- id: markdownlint
3119
entry: markdownlint --ignore .github
3220

3321
- repo: https://github.com/econchick/interrogate
34-
rev: 1.4.0
22+
rev: 1.5.0
3523
hooks:
3624
- id: interrogate
3725
args: [-vv, -i, --fail-under=80]
26+
exclude: ^tests/

docs/conf.py

-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88

99
sys.path.insert(0, os.path.abspath('..'))
1010

11-
12-
import sphinx_rtd_theme
1311
from s_tool import __version__ as _version
1412

15-
1613
# -- Project information -----------------------------------------------------
1714
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1815

examples/with_class_object.py

-26
This file was deleted.

examples/with_context_manager.py

-12
This file was deleted.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = ["Ravishankar Chavare <[email protected]>", "Aahnik Daw <daw@a
66
packages = [{include = "s_tool"}]
77

88
license = "MIT"
9-
readme = "README.md"
9+
readme = "README.rst"
1010
repository = "https://github.com/Python-World/s-tool"
1111
keywords = ["Python","Selenium","wrapper",'Webdriver',"Tools","Utilities"]
1212
classifiers = [

s_tool/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
from selenium.webdriver.support.select import Select
2121
from selenium.webdriver.support.ui import WebDriverWait
2222

23+
from .driver import SeleniumDriver
2324
from .exceptions import InvalidWebDriverError, SToolException
2425
from .logger import logger
2526
from .parser import LxmlParser
26-
from .driver import SeleniumDriver
2727

2828

2929
class SeleniumTools:

s_tool/driver.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from selenium.webdriver.chrome.service import Service as ChromeService
77
from selenium.webdriver.ie.service import Service as IEService
88
from webdriver_manager.chrome import ChromeDriverManager
9-
from webdriver_manager.microsoft import IEDriverManager
109
from webdriver_manager.firefox import GeckoDriverManager
10+
from webdriver_manager.microsoft import IEDriverManager
1111

1212

1313
class SeleniumDriver:

tests/test_core.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
import unittest
32
import os
3+
import unittest
44

55
from selenium import webdriver
66
from selenium.webdriver.chrome.options import Options
@@ -29,7 +29,7 @@ def setUpClass(cls):
2929
options.add_argument('--disable-gpu') # Last I checked this was necessary.
3030

3131
cls.driver = webdriver.Chrome(chrome_options=options,service=ChromeService(ChromeDriverManager().install()))
32-
cls.selenium_tools = SeleniumTools(driver=cls.driver,parser_class=LXMLParser)
32+
cls.selenium_tools = SeleniumTools(driver=cls.driver,parser=LXMLParser)
3333
cls.url = "https://www.example.com/"
3434
cls.example_file =os.path.join(os.path.dirname(__file__),'data/example.html')
3535
cls.selenium_tools.get(cls.url)
@@ -44,8 +44,8 @@ def test_get_supported_browsers(self):
4444
self.assertIsInstance(supported_browsers, list)
4545
self.assertGreater(len(supported_browsers), 0)
4646

47-
def test_get_driver_sessionid(self):
48-
session_id = self.selenium_tools.get_driver_sessionid()
47+
def test_sessionid(self):
48+
session_id = self.selenium_tools.sessionid()
4949
self.assertIsInstance(session_id, str)
5050
self.assertGreater(len(session_id), 0)
5151

tests/test_parser.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
import unittest
3+
4+
from s_tool.parser import LxmlParser
5+
6+
7+
class LxmlParserTestCase(unittest.TestCase):
8+
@classmethod
9+
def setUpClass(cls):
10+
cls.parser = LxmlParser()
11+
12+
def test_dropdown(self):
13+
html_string = """
14+
<html>
15+
<body>
16+
<select>
17+
<option value="1">Option 1</option>
18+
<option value="2">Option 2</option>
19+
<option value="3">Option 3</option>
20+
</select>
21+
</body>
22+
</html>"""
23+
24+
expected_result = [('Option 1', '1'), ('Option 2', '2'), ('Option 3', '3')]
25+
dropdown_options = self.parser.dropdown(html_string)
26+
27+
self.assertEqual(expected_result,dropdown_options)
28+
self.assertTrue(len(dropdown_options)==3)
29+

0 commit comments

Comments
 (0)