Skip to content

Commit

Permalink
Add test__utils_selenium.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jrycw committed Nov 19, 2024
1 parent 4c6d965 commit 41e1611
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/test__utils_selenium.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import pytest
from selenium import webdriver

from great_tables._utils_selenium import (
_get_web_driver,
no_op_callable,
_ChromeWebDriver,
_SafariWebDriver,
_FirefoxWebDriver,
_EdgeWebDriver,
)


def test_no_op_callable():
fake_input = object()
f = no_op_callable(fake_input)
assert f(1, x="x") is fake_input


def test_test_get_remote_web_driver():
with webdriver.Chrome() as web_driver:
wdriver = _get_web_driver(web_driver)
assert wdriver() is web_driver


@pytest.mark.parametrize(
"web_driver,Driver",
[
("chrome", _ChromeWebDriver),
("safari", _SafariWebDriver),
("firefox", _FirefoxWebDriver),
("edge", _EdgeWebDriver),
],
)
def test_get_web_driver(web_driver, Driver):
assert _get_web_driver(web_driver) is Driver


def test_get_web_driver_raise():
fake_web_driver = "fake_web_driver"
with pytest.raises(ValueError) as exc_info:
_get_web_driver(fake_web_driver)
assert exc_info.value.args[0] == f"Unsupported web driver: {fake_web_driver}"

0 comments on commit 41e1611

Please sign in to comment.