Skip to content

Commit

Permalink
Merge pull request #59 from Python-World/STOOL2
Browse files Browse the repository at this point in the history
upgraded python version 3.11
  • Loading branch information
chavarera committed Jun 4, 2023
2 parents 6685a55 + c84dfb2 commit 7588add
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 63 deletions.
19 changes: 4 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:

- repo: https://github.com/pycqa/isort
rev: 5.8.0
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
Expand All @@ -11,27 +11,16 @@ repos:
- id: isort
name: isort (pyi)
types: [pyi]

- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
language_version: python3
entry: black . --check

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
hooks:
- id: mypy

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.27.1
rev: v0.34.0
hooks:
- id: markdownlint
entry: markdownlint --ignore .github

- repo: https://github.com/econchick/interrogate
rev: 1.4.0
rev: 1.5.0
hooks:
- id: interrogate
args: [-vv, -i, --fail-under=80]
exclude: ^tests/
3 changes: 0 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@

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


import sphinx_rtd_theme
from s_tool import __version__ as _version


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

Expand Down
26 changes: 0 additions & 26 deletions examples/with_class_object.py

This file was deleted.

12 changes: 0 additions & 12 deletions examples/with_context_manager.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Ravishankar Chavare <[email protected]>", "Aahnik Daw <daw@a
packages = [{include = "s_tool"}]

license = "MIT"
readme = "README.md"
readme = "README.rst"
repository = "https://github.com/Python-World/s-tool"
keywords = ["Python","Selenium","wrapper",'Webdriver',"Tools","Utilities"]
classifiers = [
Expand Down
2 changes: 1 addition & 1 deletion s_tool/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.ui import WebDriverWait

from .driver import SeleniumDriver
from .exceptions import InvalidWebDriverError, SToolException
from .logger import logger
from .parser import LxmlParser
from .driver import SeleniumDriver


class SeleniumTools:
Expand Down
2 changes: 1 addition & 1 deletion s_tool/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver.ie.service import Service as IEService
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.microsoft import IEDriverManager
from webdriver_manager.firefox import GeckoDriverManager
from webdriver_manager.microsoft import IEDriverManager


class SeleniumDriver:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import unittest
import os
import unittest

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

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

def test_get_driver_sessionid(self):
session_id = self.selenium_tools.get_driver_sessionid()
def test_sessionid(self):
session_id = self.selenium_tools.sessionid()
self.assertIsInstance(session_id, str)
self.assertGreater(len(session_id), 0)

Expand Down
29 changes: 29 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

import unittest

from s_tool.parser import LxmlParser


class LxmlParserTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.parser = LxmlParser()

def test_dropdown(self):
html_string = """
<html>
<body>
<select>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
</body>
</html>"""

expected_result = [('Option 1', '1'), ('Option 2', '2'), ('Option 3', '3')]
dropdown_options = self.parser.dropdown(html_string)

self.assertEqual(expected_result,dropdown_options)
self.assertTrue(len(dropdown_options)==3)

0 comments on commit 7588add

Please sign in to comment.