-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |