code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def disabled_element(mock_connection_handler):
"""Disabled element fixture for testing enabled/disabled state."""
attributes_list = [
'id', 'disabled-id',
'tag_name', 'button',
'disabled', 'true'
]
return WebElement(
object_id='disabled-object-id',
connection_hand... | Disabled element fixture for testing enabled/disabled state. | disabled_element | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
def test_web_element_initialization_empty_attributes(self, mock_connection_handler):
"""Test WebElement initialization with empty attributes list."""
element = WebElement(
object_id='empty-id',
connection_handler=mock_connection_handler,
attributes_list=[]
)
... | Test WebElement initialization with empty attributes list. | test_web_element_initialization_empty_attributes | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
def test_web_element_initialization_odd_attributes(self, mock_connection_handler):
"""Test WebElement initialization with odd number of attributes (causes IndexError)."""
attributes_list = ['id', 'test-id', 'class'] # Missing value for 'class'
# This should raise IndexError because _de... | Test WebElement initialization with odd number of attributes (causes IndexError). | test_web_element_initialization_odd_attributes | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
def test_class_attribute_renamed_to_class_name(self, mock_connection_handler):
"""Test that 'class' attribute is renamed to 'class_name'."""
attributes_list = ['class', 'my-class', 'id', 'my-id']
element = WebElement(
object_id='class-test',
connection_handler=mock_connec... | Test that 'class' attribute is renamed to 'class_name'. | test_class_attribute_renamed_to_class_name | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
def test_is_enabled_property(self, web_element, disabled_element):
"""Test is_enabled property for enabled and disabled elements."""
assert web_element.is_enabled is True
assert disabled_element.is_enabled is False | Test is_enabled property for enabled and disabled elements. | test_is_enabled_property | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
def test_properties_with_none_values(self, mock_connection_handler):
"""Test properties when attributes are not present."""
element = WebElement(
object_id='empty-element',
connection_handler=mock_connection_handler,
attributes_list=[]
)
assert element... | Test properties when attributes are not present. | test_properties_with_none_values | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_text_property(self, web_element):
"""Test text property extraction from HTML."""
test_html = '<div>Hello <span>World</span></div>'
web_element._connection_handler.execute_command.return_value = {
'result': {'outerHTML': test_html}
}
text = await web_el... | Test text property extraction from HTML. | test_text_property | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_text_property_with_nested_elements(self, web_element):
"""Test text property with complex nested HTML."""
test_html = '<div>Text <b>Bold</b> <i>Italic</i> More text</div>'
web_element._connection_handler.execute_command.return_value = {
'result': {'outerHTML': test_htm... | Test text property with complex nested HTML. | test_text_property_with_nested_elements | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_bounds_property(self, web_element):
"""Test bounds property returns correct coordinates."""
expected_bounds = [0, 0, 100, 100, 100, 100, 0, 100]
web_element._connection_handler.execute_command.return_value = {
'result': {'model': {'content': expected_bounds}}
}... | Test bounds property returns correct coordinates. | test_bounds_property | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_type_text(self, input_element):
"""Test type_text method with character-by-character typing."""
test_text = 'Hi'
with patch('asyncio.sleep') as mock_sleep:
await input_element.type_text(test_text, interval=0.05)
# Should call execute_command for each character... | Test type_text method with character-by-character typing. | test_type_text | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_click_using_js_not_visible(self, web_element):
"""Test JavaScript click when element is not visible."""
web_element._is_element_visible = AsyncMock(return_value=False)
web_element.scroll_into_view = AsyncMock()
with pytest.raises(ElementNotVisible):
await web_... | Test JavaScript click when element is not visible. | test_click_using_js_not_visible | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_click_using_js_not_interactable(self, web_element):
"""Test JavaScript click when element is not interactable."""
web_element._is_element_visible = AsyncMock(return_value=True)
web_element.scroll_into_view = AsyncMock()
web_element._execute_script = AsyncMock(
... | Test JavaScript click when element is not interactable. | test_click_using_js_not_interactable | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_click_using_js_option_element(self, option_element):
"""Test JavaScript click on option element uses specialized method."""
option_element._click_option_tag = AsyncMock()
await option_element.click_using_js()
option_element._click_option_tag.assert_called... | Test JavaScript click on option element uses specialized method. | test_click_using_js_option_element | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_click_not_visible(self, web_element):
"""Test click when element is not visible."""
web_element._is_element_visible = AsyncMock(return_value=False)
with pytest.raises(ElementNotVisible):
await web_element.click() | Test click when element is not visible. | test_click_not_visible | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_click_option_element(self, option_element):
"""Test click on option element uses specialized method."""
option_element._click_option_tag = AsyncMock()
await option_element.click()
option_element._click_option_tag.assert_called_once() | Test click on option element uses specialized method. | test_click_option_element | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_click_bounds_fallback_to_js(self, web_element):
"""Test click falls back to JS bounds when CDP bounds fail."""
web_element._is_element_visible = AsyncMock(return_value=True)
web_element.scroll_into_view = AsyncMock()
# First call (bounds) raises KeyError, second c... | Test click falls back to JS bounds when CDP bounds fail. | test_click_bounds_fallback_to_js | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_set_input_files_not_file_input(self, web_element):
"""Test set_input_files on non-file input element."""
files = ['/path/to/file.txt']
with pytest.raises(ElementNotAFileInput):
await web_element.set_input_files(files) | Test set_input_files on non-file input element. | test_set_input_files_not_file_input | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_set_input_files_input_but_wrong_type(self, input_element):
"""Test set_input_files on input element with wrong type."""
files = ['/path/to/file.txt']
with pytest.raises(ElementNotAFileInput):
await input_element.set_input_files(files) | Test set_input_files on input element with wrong type. | test_set_input_files_input_but_wrong_type | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_find_element_not_found_with_exception(self, web_element):
"""Test element not found raises exception."""
web_element._connection_handler.execute_command.return_value = {
'result': {'result': {}}
}
with pytest.raises(ElementNotFound):
await ... | Test element not found raises exception. | test_find_element_not_found_with_exception | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_find_element_not_found_no_exception(self, web_element):
"""Test element not found returns None when raise_exc=False."""
web_element._connection_handler.execute_command.return_value = {
'result': {'result': {}}
}
result = await web_element.find(id='none... | Test element not found returns None when raise_exc=False. | test_find_element_not_found_no_exception | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_find_with_timeout_success(self, web_element):
"""Test find with timeout succeeds on retry."""
node_response = {'result': {'result': {'objectId': 'delayed-element'}}}
describe_response = {
'result': {
'node': {'nodeName': 'DIV', 'attributes': []}
... | Test find with timeout succeeds on retry. | test_find_with_timeout_success | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_find_with_timeout_failure(self, web_element):
"""Test find with timeout raises WaitElementTimeout."""
web_element._connection_handler.execute_command.return_value = {
'result': {'result': {}}
}
with patch('asyncio.get_event_loop') as mock_loop:
... | Test find with timeout raises WaitElementTimeout. | test_find_with_timeout_failure | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_query_css_selector(self, web_element):
"""Test query method with CSS selector."""
node_response = {'result': {'result': {'objectId': 'queried-element'}}}
describe_response = {
'result': {
'node': {'nodeName': 'A', 'attributes': ['href', 'http://example.... | Test query method with CSS selector. | test_query_css_selector | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_query_xpath(self, web_element):
"""Test query method with XPath expression."""
node_response = {'result': {'result': {'objectId': 'xpath-element'}}}
describe_response = {
'result': {
'node': {'nodeName': 'SPAN', 'attributes': []}
}
}... | Test query method with XPath expression. | test_query_xpath | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_bounds_property_with_connection_error(self, web_element):
"""Test bounds property when connection fails."""
web_element._connection_handler.execute_command.side_effect = Exception("Connection failed")
with pytest.raises(Exception, match="Connection failed"):
a... | Test bounds property when connection fails. | test_bounds_property_with_connection_error | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_text_property_with_malformed_html(self, web_element):
"""Test text property with malformed HTML."""
malformed_html = '<div>Unclosed tag <span>content'
web_element._connection_handler.execute_command.return_value = {
'result': {'outerHTML': malformed_html}
}
... | Test text property with malformed HTML. | test_text_property_with_malformed_html | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_click_with_zero_hold_time(self, web_element):
"""Test click with zero hold time."""
bounds = [0, 0, 50, 0, 50, 50, 0, 50]
web_element._is_element_visible = AsyncMock(return_value=True)
web_element.scroll_into_view = AsyncMock()
web_element._connection_handler.execu... | Test click with zero hold time. | test_click_with_zero_hold_time | python | autoscrape-labs/pydoll | tests/test_web_element.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_web_element.py | MIT |
async def test_get_valid_tab_id_no_valid_tabs():
"""Test _get_valid_tab_id when there are no valid tabs."""
targets = [
{'type': 'extension', 'url': 'chrome-extension://abc123', 'targetId': 'ext_1'},
{'type': 'background_page', 'url': 'chrome://background', 'targetId': 'bg_1'}
]
wit... | Test _get_valid_tab_id when there are no valid tabs. | test_get_valid_tab_id_no_valid_tabs | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_base.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_base.py | MIT |
async def test_get_valid_tab_id_missing_target_id():
"""Test _get_valid_tab_id when valid tab has no targetId."""
targets = [
{'type': 'page', 'url': 'https://example.com'}, # No targetId
{'type': 'extension', 'url': 'chrome-extension://abc123', 'targetId': 'ext_1'}
]
with pytest.r... | Test _get_valid_tab_id when valid tab has no targetId. | test_get_valid_tab_id_missing_target_id | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_base.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_base.py | MIT |
def test_chrome_initialization_default_options(self):
"""Test Chrome initialization with default options."""
with patch.multiple(
Chrome,
_get_default_binary_location=MagicMock(return_value='/fake/chrome'),
), patch(
'pydoll.browser.managers.browser_process_ma... | Test Chrome initialization with default options. | test_chrome_initialization_default_options | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_chrome_initialization_custom_options(self):
"""Test Chrome initialization with custom options."""
custom_options = ChromiumOptions()
custom_options.add_argument('--disable-web-security')
custom_options.binary_location = '/custom/chrome/path'
with patch.multiple(... | Test Chrome initialization with custom options. | test_chrome_initialization_custom_options | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_chrome_initialization_custom_port(self):
"""Test Chrome initialization with custom port."""
custom_port = 9999
with patch.multiple(
Chrome,
_get_default_binary_location=MagicMock(return_value='/fake/chrome'),
), patch(
'pydoll.browser... | Test Chrome initialization with custom port. | test_chrome_initialization_custom_port | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_chrome_initialization_both_custom(self):
"""Test Chrome initialization with both custom options and port."""
custom_options = ChromiumOptions()
custom_options.add_argument('--headless')
custom_port = 8888
with patch.multiple(
Chrome,
_get... | Test Chrome initialization with both custom options and port. | test_chrome_initialization_both_custom | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_get_default_binary_location_success(
self, mock_platform_system, mock_validate_browser_paths, os_name, expected_paths
):
"""Test successful default binary detection for different operating systems."""
mock_platform_system.return_value = os_name
expected_path = expected_paths... | Test successful default binary detection for different operating systems. | test_get_default_binary_location_success | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_get_default_binary_location_unsupported_os(self, mock_platform_system):
"""Test exception for unsupported operating system."""
mock_platform_system.return_value = 'FreeBSD'
with pytest.raises(UnsupportedOS, match='Unsupported OS: FreeBSD'):
Chrome._get_default_binar... | Test exception for unsupported operating system. | test_get_default_binary_location_unsupported_os | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_get_default_binary_location_unknown_os(self, mock_platform_system):
"""Test exception for unknown operating system."""
mock_platform_system.return_value = 'UnknownOS'
with pytest.raises(UnsupportedOS, match='Unsupported OS: UnknownOS'):
Chrome._get_default_binary_lo... | Test exception for unknown operating system. | test_get_default_binary_location_unknown_os | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_get_default_binary_location_windows_fallback(
self, mock_platform_system, mock_validate_browser_paths
):
"""Test fallback for different paths on Windows."""
mock_platform_system.return_value = 'Windows'
expected_path = r'C:\Program Files (x86)\Google\Chrome\Application\chrom... | Test fallback for different paths on Windows. | test_get_default_binary_location_windows_fallback | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_options_manager_with_none_options(self):
"""Test options manager creation with None options."""
with patch.multiple(
Chrome,
_get_default_binary_location=MagicMock(return_value='/fake/chrome'),
), patch(
'pydoll.browser.managers.browser_process_manage... | Test options manager creation with None options. | test_options_manager_with_none_options | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_chrome_inherits_from_browser(self):
"""Test if Chrome correctly inherits from Browser."""
from pydoll.browser.chromium.base import Browser
with patch.multiple(
Chrome,
_get_default_binary_location=MagicMock(return_value='/fake/chrome'),
), patch(... | Test if Chrome correctly inherits from Browser. | test_chrome_inherits_from_browser | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_chrome_overrides_get_default_binary_location(self):
"""Test if Chrome overrides the _get_default_binary_location method."""
# Verify that the method is static and exists
assert hasattr(Chrome, '_get_default_binary_location')
assert callable(Chrome._get_default_binary_location)
... | Test if Chrome overrides the _get_default_binary_location method. | test_chrome_overrides_get_default_binary_location | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_chrome_with_zero_port(self):
"""Test Chrome with zero port (should generate random port since 0 is falsy)."""
with patch.multiple(
Chrome,
_get_default_binary_location=MagicMock(return_value='/fake/chrome'),
), patch(
'pydoll.browser.managers.browser_... | Test Chrome with zero port (should generate random port since 0 is falsy). | test_chrome_with_zero_port | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_chrome_with_negative_port(self):
"""Test Chrome with negative port (should raise ValueError)."""
with patch.multiple(
Chrome,
_get_default_binary_location=MagicMock(return_value='/fake/chrome'),
), patch(
'pydoll.browser.managers.browser_process_manag... | Test Chrome with negative port (should raise ValueError). | test_chrome_with_negative_port | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_chrome.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_chrome.py | MIT |
def test_edge_initialization_default_options(self):
"""Test Edge initialization with default options."""
with patch.multiple(
Edge,
_get_default_binary_location=MagicMock(return_value='/fake/edge'),
), patch(
'pydoll.browser.managers.browser_process_manager.Br... | Test Edge initialization with default options. | test_edge_initialization_default_options | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
def test_edge_initialization_custom_options(self):
"""Test Edge initialization with custom options."""
custom_options = ChromiumOptions()
custom_options.add_argument('--disable-web-security')
custom_options.binary_location = '/custom/edge/path'
with patch.multiple(
... | Test Edge initialization with custom options. | test_edge_initialization_custom_options | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
def test_edge_initialization_custom_port(self):
"""Test Edge initialization with custom port."""
custom_port = 9999
with patch.multiple(
Edge,
_get_default_binary_location=MagicMock(return_value='/fake/edge'),
), patch(
'pydoll.browser.manager... | Test Edge initialization with custom port. | test_edge_initialization_custom_port | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
def test_edge_initialization_both_custom(self):
"""Test Edge initialization with both custom options and port."""
custom_options = ChromiumOptions()
custom_options.add_argument('--headless')
custom_port = 8888
with patch.multiple(
Edge,
_get_defau... | Test Edge initialization with both custom options and port. | test_edge_initialization_both_custom | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
def test_edge_inherits_from_browser(self):
"""Test if Edge correctly inherits from Browser."""
from pydoll.browser.chromium.base import Browser
with patch.multiple(
Edge,
_get_default_binary_location=MagicMock(return_value='/fake/edge'),
), patch(
... | Test if Edge correctly inherits from Browser. | test_edge_inherits_from_browser | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
def test_edge_overrides_get_default_binary_location(self):
"""Test if Edge overrides the _get_default_binary_location method."""
# Verify that the method is static and exists
assert hasattr(Edge, '_get_default_binary_location')
assert callable(Edge._get_default_binary_location)
... | Test if Edge overrides the _get_default_binary_location method. | test_edge_overrides_get_default_binary_location | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
def test_edge_uses_chromium_options_manager(self):
"""Test if Edge uses ChromiumOptionsManager like Chrome."""
with patch.multiple(
Edge,
_get_default_binary_location=MagicMock(return_value='/fake/edge'),
), patch(
'pydoll.browser.managers.browser_process_mana... | Test if Edge uses ChromiumOptionsManager like Chrome. | test_edge_uses_chromium_options_manager | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
def test_edge_with_zero_port(self):
"""Test Edge with zero port (should generate random port since 0 is falsy)."""
with patch.multiple(
Edge,
_get_default_binary_location=MagicMock(return_value='/fake/edge'),
), patch(
'pydoll.browser.managers.browser_process_... | Test Edge with zero port (should generate random port since 0 is falsy). | test_edge_with_zero_port | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
def test_edge_with_negative_port(self):
"""Test Edge with negative port (should raise ValueError)."""
with patch.multiple(
Edge,
_get_default_binary_location=MagicMock(return_value='/fake/edge'),
), patch(
'pydoll.browser.managers.browser_process_manager.Brows... | Test Edge with negative port (should raise ValueError). | test_edge_with_negative_port | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
def test_edge_with_edge_specific_arguments(self):
"""Test Edge with Edge-specific command line arguments."""
custom_options = ChromiumOptions()
custom_options.add_argument('--enable-features=msEdgeEnhancedSecurity')
custom_options.add_argument('--edge-webview-enable-builtin-background-ex... | Test Edge with Edge-specific command line arguments. | test_edge_with_edge_specific_arguments | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
def test_edge_vs_chrome_compatibility(self):
"""Test that Edge and Chrome use compatible interfaces."""
from pydoll.browser.chromium.chrome import Chrome
with patch.multiple(
Edge,
_get_default_binary_location=MagicMock(return_value='/fake/edge'),
), patc... | Test that Edge and Chrome use compatible interfaces. | test_edge_vs_chrome_compatibility | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_edge.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_edge.py | MIT |
async def mock_connection_handler():
"""Mock connection handler for Tab tests."""
with patch('pydoll.connection.ConnectionHandler', autospec=True) as mock:
handler = mock.return_value
handler.execute_command = AsyncMock()
handler.register_callback = AsyncMock()
handler.remove_cal... | Mock connection handler for Tab tests. | mock_connection_handler | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_enable_fetch_events(self, tab):
"""Test enabling fetch events with default parameters."""
await tab.enable_fetch_events()
assert tab.fetch_events_enabled is True
tab._connection_handler.execute_command.assert_called_once() | Test enabling fetch events with default parameters. | test_enable_fetch_events | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_enable_fetch_events_with_params(self, tab):
"""Test enabling fetch events with custom parameters."""
await tab.enable_fetch_events(
handle_auth=True,
resource_type=ResourceType.DOCUMENT,
request_stage=RequestStage.REQUEST
)
assert tab.fe... | Test enabling fetch events with custom parameters. | test_enable_fetch_events_with_params | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_enable_intercept_file_chooser_dialog(self, tab):
"""Test enabling file chooser dialog interception."""
await tab.enable_intercept_file_chooser_dialog()
assert tab.intercept_file_chooser_dialog_enabled is True
tab._connection_handler.execute_command.assert_called_once() | Test enabling file chooser dialog interception. | test_enable_intercept_file_chooser_dialog | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_disable_intercept_file_chooser_dialog(self, tab):
"""Test disabling file chooser dialog interception."""
tab._intercept_file_chooser_dialog_enabled = True
await tab.disable_intercept_file_chooser_dialog()
assert tab.intercept_file_chooser_dialog_enabled is False
ta... | Test disabling file chooser dialog interception. | test_disable_intercept_file_chooser_dialog | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_go_to_same_url(self, tab):
"""Test navigating to the same URL (should refresh)."""
tab._connection_handler.execute_command.side_effect = [
{'result': {'result': {'value': 'https://example.com'}}}, # current_url
{'result': {}}, # refresh command
{'resu... | Test navigating to the same URL (should refresh). | test_go_to_same_url | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_take_screenshot_to_file(self, tab, tmp_path):
"""Test taking screenshot and saving to file."""
screenshot_data = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB/edzE+oAAAAASUVORK5CYII='
tab._connection_handler.execute_command.return_value = {
'res... | Test taking screenshot and saving to file. | test_take_screenshot_to_file | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_take_screenshot_as_base64(self, tab):
"""Test taking screenshot and returning as base64."""
screenshot_data = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAgAB/edzE+oAAAAASUVORK5CYII='
tab._connection_handler.execute_command.return_value = {
'result... | Test taking screenshot and returning as base64. | test_take_screenshot_as_base64 | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_print_to_pdf_to_file(self, tab, tmp_path):
"""Test printing to PDF and saving to file."""
pdf_data = 'JVBERi0xLjQKJdPr6eEKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwo+PgplbmRvYmoKdHJhaWxlcgo8PAovUm9vdCAxIDAgUgo+PgpzdGFydHhyZWYKMTgKJSVFT0Y='
tab._connection_handler.execute_command.return_va... | Test printing to PDF and saving to file. | test_print_to_pdf_to_file | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_print_to_pdf_as_base64(self, tab):
"""Test printing to PDF and returning as base64."""
pdf_data = 'JVBERi0xLjQKJdPr6eEKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwo+PgplbmRvYmoKdHJhaWxlcgo8PAovUm9vdCAxIDAgUgo+PgpzdGFydHhyZWYKMTgKJSVFT0Y='
tab._connection_handler.execute_command.return_value... | Test printing to PDF and returning as base64. | test_print_to_pdf_as_base64 | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_print_to_pdf_with_options(self, tab, tmp_path):
"""Test printing to PDF with custom options."""
pdf_data = 'JVBERi0xLjQKJdPr6eEKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwo+PgplbmRvYmoKdHJhaWxlcgo8PAovUm9vdCAxIDAgUgo+PgpzdGFydHhyZWYKMTgKJSVFT0Y='
tab._connection_handler.execute_command.ret... | Test printing to PDF with custom options. | test_print_to_pdf_with_options | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_has_dialog_false(self, tab):
"""Test has_dialog when no dialog is present."""
tab._connection_handler.dialog = None
result = await tab.has_dialog()
assert result is False | Test has_dialog when no dialog is present. | test_has_dialog_false | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_get_dialog_message_success(self, tab):
"""Test getting dialog message when dialog is present."""
tab._connection_handler.dialog = {'params': {'message': 'Test message'}}
message = await tab.get_dialog_message()
assert message == 'Test message' | Test getting dialog message when dialog is present. | test_get_dialog_message_success | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_get_dialog_message_no_dialog(self, tab):
"""Test getting dialog message when no dialog is present."""
tab._connection_handler.dialog = None
with pytest.raises(NoDialogPresent):
await tab.get_dialog_message() | Test getting dialog message when no dialog is present. | test_get_dialog_message_no_dialog | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_handle_dialog_with_prompt_text(self, tab):
"""Test handling a prompt dialog with text."""
tab._connection_handler.dialog = {'params': {'type': 'prompt'}}
await tab.handle_dialog(accept=True, prompt_text='Test input')
tab._connection_handler.execute_comman... | Test handling a prompt dialog with text. | test_handle_dialog_with_prompt_text | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_handle_dialog_no_dialog(self, tab):
"""Test handling dialog when none is present."""
tab._connection_handler.dialog = None
with pytest.raises(NoDialogPresent):
await tab.handle_dialog(accept=True) | Test handling dialog when none is present. | test_handle_dialog_no_dialog | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_execute_script_with_element(self, tab):
"""Test executing JavaScript with element context."""
mock_element = WebElement(
object_id='test-element-id',
connection_handler=tab._connection_handler
)
tab._connection_handler.execute_command.retur... | Test executing JavaScript with element context. | test_execute_script_with_element | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_enable_auto_solve_cloudflare_captcha(self, tab):
"""Test enabling auto-solve Cloudflare captcha."""
callback_id = 999
tab._connection_handler.register_callback.return_value = callback_id
mock_enable_page_events = AsyncMock()
with patch.object(tab, 'enable_... | Test enabling auto-solve Cloudflare captcha. | test_enable_auto_solve_cloudflare_captcha | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_enable_auto_solve_cloudflare_captcha_with_params(self, tab):
"""Test enabling auto-solve Cloudflare captcha with custom parameters."""
callback_id = 888
tab._connection_handler.register_callback.return_value = callback_id
custom_selector = (By.ID, 'custom-captcha'... | Test enabling auto-solve Cloudflare captcha with custom parameters. | test_enable_auto_solve_cloudflare_captcha_with_params | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_disable_auto_solve_cloudflare_captcha(self, tab):
"""Test disabling auto-solve Cloudflare captcha."""
tab._cloudflare_captcha_callback_id = 777
tab._connection_handler.remove_callback.return_value = True
await tab.disable_auto_solve_cloudflare_captcha()
... | Test disabling auto-solve Cloudflare captcha. | test_disable_auto_solve_cloudflare_captcha | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_bypass_cloudflare_no_element_found(self, tab):
"""Test _bypass_cloudflare when no element is found."""
mock_find = AsyncMock(return_value=None)
mock_execute_script = AsyncMock()
with patch.object(tab, 'find_or_wait_element', mock_find):
with patch.obje... | Test _bypass_cloudflare when no element is found. | test_bypass_cloudflare_no_element_found | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_get_frame_success(self, tab, mock_browser):
"""Test getting frame from iframe element."""
mock_iframe_element = MagicMock()
mock_iframe_element.tag_name = 'iframe'
mock_iframe_element.get_attribute.return_value = 'https://example.com/iframe'
mock_iframe_element._ob... | Test getting frame from iframe element. | test_get_frame_success | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_get_frame_not_iframe(self, tab):
"""Test getting frame from non-iframe element."""
mock_element = MagicMock()
mock_element.tag_name = 'div' # Mock the property directly
with pytest.raises(NotAnIFrame):
await tab.get_frame(mock_element) | Test getting frame from non-iframe element. | test_get_frame_not_iframe | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
async def test_get_frame_no_frame_id(self, tab, mock_browser):
"""Test getting frame when no frame ID is found."""
mock_iframe_element = MagicMock()
mock_iframe_element.tag_name = 'iframe' # Mock the _attributes dict
mock_iframe_element.get_attribute.return_value = 'https://example.com/... | Test getting frame when no frame ID is found. | test_get_frame_no_frame_id | python | autoscrape-labs/pydoll | tests/test_browser/test_browser_tab.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_browser/test_browser_tab.py | MIT |
def test_window_bounds_with_all_states():
"""Test window bounds with all possible window states."""
window_id = 1
# Test NORMAL state
bounds_normal = {'windowState': WindowState.NORMAL}
command_normal = BrowserCommands.set_window_bounds(window_id, bounds_normal)
assert command_normal['param... | Test window bounds with all possible window states. | test_window_bounds_with_all_states | python | autoscrape-labs/pydoll | tests/test_commands/test_browser_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_browser_commands.py | MIT |
def test_enable_minimal(self):
"""Test enable command with minimal parameters."""
handle_auth = True
result = FetchCommands.enable(handle_auth_requests=handle_auth)
assert result['method'] == FetchMethod.ENABLE
assert result['params']['handleAuthRequests'] == handle_auth... | Test enable command with minimal parameters. | test_enable_minimal | python | autoscrape-labs/pydoll | tests/test_commands/test_fetch_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_fetch_commands.py | MIT |
def test_enable_with_url_pattern(self):
"""Test enable command with custom URL pattern."""
handle_auth = False
url_pattern = 'https://api.example.com/*'
result = FetchCommands.enable(
handle_auth_requests=handle_auth,
url_pattern=url_pattern
)
... | Test enable command with custom URL pattern. | test_enable_with_url_pattern | python | autoscrape-labs/pydoll | tests/test_commands/test_fetch_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_fetch_commands.py | MIT |
def test_enable_with_resource_type(self):
"""Test enable command with resource type."""
handle_auth = True
resource_type = ResourceType.DOCUMENT
result = FetchCommands.enable(
handle_auth_requests=handle_auth,
resource_type=resource_type
)
... | Test enable command with resource type. | test_enable_with_resource_type | python | autoscrape-labs/pydoll | tests/test_commands/test_fetch_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_fetch_commands.py | MIT |
def test_enable_with_request_stage(self):
"""Test enable command with request stage."""
handle_auth = True
request_stage = RequestStage.REQUEST
result = FetchCommands.enable(
handle_auth_requests=handle_auth,
request_stage=request_stage
)
... | Test enable command with request stage. | test_enable_with_request_stage | python | autoscrape-labs/pydoll | tests/test_commands/test_fetch_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_fetch_commands.py | MIT |
def test_enable_with_all_params(self):
"""Test enable command with all parameters."""
handle_auth = True
url_pattern = 'https://test.com/*'
resource_type = ResourceType.XHR
request_stage = RequestStage.RESPONSE
result = FetchCommands.enable(
handle_au... | Test enable command with all parameters. | test_enable_with_all_params | python | autoscrape-labs/pydoll | tests/test_commands/test_fetch_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_fetch_commands.py | MIT |
def test_fail_request_with_different_error(self):
"""Test fail_request command with different error reason."""
request_id = 'req123'
error_reason = NetworkErrorReason.TIMED_OUT
result = FetchCommands.fail_request(
request_id=request_id,
error_reason=error_reason
... | Test fail_request command with different error reason. | test_fail_request_with_different_error | python | autoscrape-labs/pydoll | tests/test_commands/test_fetch_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_fetch_commands.py | MIT |
def test_key_event_with_location():
"""Test key event with location parameter."""
result = InputCommands.dispatch_key_event(
type=KeyEventType.KEY_DOWN,
key='Shift',
location=KeyLocation.LEFT,
)
assert result['method'] == InputMethod.DISPATCH_KEY_EVENT
assert result['params']... | Test key event with location parameter. | test_key_event_with_location | python | autoscrape-labs/pydoll | tests/test_commands/test_input_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_input_commands.py | MIT |
def test_touch_event_multiple_points():
"""Test touch event with multiple touch points."""
touch_points = [
{
'x': 100,
'y': 200,
'radiusX': 10,
'radiusY': 10,
'rotationAngle': 0,
'force': 1.0,
},
{
'x': ... | Test touch event with multiple touch points. | test_touch_event_multiple_points | python | autoscrape-labs/pydoll | tests/test_commands/test_input_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_input_commands.py | MIT |
def test_disable():
"""Test disable method generates correct command."""
result = NetworkCommands.disable()
assert result['method'] == NetworkMethod.DISABLE
assert 'params' not in result | Test disable method generates correct command. | test_disable | python | autoscrape-labs/pydoll | tests/test_commands/test_network_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_network_commands.py | MIT |
def test_enable_with_buffer_sizes():
"""Test enable with buffer size parameters."""
result = NetworkCommands.enable(
max_total_buffer_size=1024000,
max_resource_buffer_size=512000,
max_post_data_size=65536
)
assert result['method'] == NetworkMethod.ENABLE
assert result['param... | Test enable with buffer size parameters. | test_enable_with_buffer_sizes | python | autoscrape-labs/pydoll | tests/test_commands/test_network_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_network_commands.py | MIT |
def test_close():
"""Test close method generates correct command."""
result = PageCommands.close()
assert result['method'] == PageMethod.CLOSE
assert 'params' not in result | Test close method generates correct command. | test_close | python | autoscrape-labs/pydoll | tests/test_commands/test_page_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_page_commands.py | MIT |
def test_enable_with_file_chooser():
"""Test enable with file chooser event enabled."""
result = PageCommands.enable(enable_file_chooser_opened_event=True)
assert result['method'] == PageMethod.ENABLE
assert result['params']['enableFileChooserOpenedEvent'] is True | Test enable with file chooser event enabled. | test_enable_with_file_chooser | python | autoscrape-labs/pydoll | tests/test_commands/test_page_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_page_commands.py | MIT |
def test_crash():
"""Test crash method generates correct command."""
result = PageCommands.crash()
assert result['method'] == PageMethod.CRASH
assert 'params' not in result | Test crash method generates correct command. | test_crash | python | autoscrape-labs/pydoll | tests/test_commands/test_page_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_page_commands.py | MIT |
def test_enable():
"""Test enable method generates correct command."""
result = RuntimeCommands.enable()
assert result['method'] == RuntimeMethod.ENABLE
assert 'params' not in result | Test enable method generates correct command. | test_enable | python | autoscrape-labs/pydoll | tests/test_commands/test_runtime_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_runtime_commands.py | MIT |
def test_evaluate_simple_expression():
"""Test evaluate with a simple mathematical expression."""
result = RuntimeCommands.evaluate(expression='Math.PI * 2')
assert result['method'] == RuntimeMethod.EVALUATE
assert result['params']['expression'] == 'Math.PI * 2' | Test evaluate with a simple mathematical expression. | test_evaluate_simple_expression | python | autoscrape-labs/pydoll | tests/test_commands/test_runtime_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_runtime_commands.py | MIT |
def test_evaluate_with_context():
"""Test evaluate with specific execution context."""
result = RuntimeCommands.evaluate(
expression='this.document.title',
context_id='ctx123',
include_command_line_api=True
)
assert result['method'] == RuntimeMethod.EVALUATE
assert result['pa... | Test evaluate with specific execution context. | test_evaluate_with_context | python | autoscrape-labs/pydoll | tests/test_commands/test_runtime_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_runtime_commands.py | MIT |
def test_create_target_with_position_and_size():
"""Test create_target with position and size parameters."""
result = TargetCommands.create_target(
url='https://test.com',
left=100,
top=200,
width=800,
height=600
)
assert result['method'] == TargetMethod.CREATE_TA... | Test create_target with position and size parameters. | test_create_target_with_position_and_size | python | autoscrape-labs/pydoll | tests/test_commands/test_target_commands.py | https://github.com/autoscrape-labs/pydoll/blob/master/tests/test_commands/test_target_commands.py | MIT |
def get_cuda_version() -> float:
"""
Get the cuda version of the system, make sure that the $CUDA_HOME or the $CUDA_PATH has been added into the system path.
Here the cuda version is aaa.b.ccc, and only return the version with aaa.b
Returns:
version (float): the cuda version.
"""
... |
Get the cuda version of the system, make sure that the $CUDA_HOME or the $CUDA_PATH has been added into the system path.
Here the cuda version is aaa.b.ccc, and only return the version with aaa.b
Returns:
version (float): the cuda version.
| get_cuda_version | python | iPERDance/iPERCore | setup.py | https://github.com/iPERDance/iPERCore/blob/master/setup.py | Apache-2.0 |
def get_python_version() -> str:
"""
Get the python version. The python version is aaa.b.c, and it only returns aaa.b
Returns:
version (str):
"""
version = str(platform.python_version())
version = "".join(version.split(".")[0:2])
assert "36" <= version <= "38", f"Currently, it ... |
Get the python version. The python version is aaa.b.c, and it only returns aaa.b
Returns:
version (str):
| get_python_version | python | iPERDance/iPERCore | setup.py | https://github.com/iPERDance/iPERCore/blob/master/setup.py | Apache-2.0 |
def get_torch_version(cuda_version_str, precompile_torch_cuda_paris, default_torch_cuda_mapper) -> str:
"""
Args:
cuda_version_str:
precompile_torch_cuda_paris (dict): PRECOMPILED_TORCH_CUDA_PAIRS or WINDOWS_PRECOMPILED_TORCH_CUDA_PAIRS
default_torch_cuda_mapper (dict): DEFAULT_LINUX_CU... |
Args:
cuda_version_str:
precompile_torch_cuda_paris (dict): PRECOMPILED_TORCH_CUDA_PAIRS or WINDOWS_PRECOMPILED_TORCH_CUDA_PAIRS
default_torch_cuda_mapper (dict): DEFAULT_LINUX_CUDA_TORCH or DEFAULT_WINDOWS_CUDA_TORCH
Returns:
torch_version (str):
| get_torch_version | python | iPERDance/iPERCore | setup.py | https://github.com/iPERDance/iPERCore/blob/master/setup.py | Apache-2.0 |
def platform_dependencies():
"""Parse the pre-complied consistent versions of torch, torchvision, mmcv, and CUDA.
The torch version must >= 1.6.0, and the CUDA version must >= 10.1.
Currently, it only supports Linux and Windows.
If the platform is Linux, we will use torch 1.7.0 + CUDA Version.
Other... | Parse the pre-complied consistent versions of torch, torchvision, mmcv, and CUDA.
The torch version must >= 1.6.0, and the CUDA version must >= 10.1.
Currently, it only supports Linux and Windows.
If the platform is Linux, we will use torch 1.7.0 + CUDA Version.
Otherwise if the platform is windows, we ... | platform_dependencies | python | iPERDance/iPERCore | setup.py | https://github.com/iPERDance/iPERCore/blob/master/setup.py | Apache-2.0 |
def parse_requirements(fname="requirements.txt", with_version=True):
"""Parse the package dependencies listed in a requirements file but strips
specific versioning information.
Args:
fname (str): path to requirements file
with_version (bool, default=False): if True include version specs
... | Parse the package dependencies listed in a requirements file but strips
specific versioning information.
Args:
fname (str): path to requirements file
with_version (bool, default=False): if True include version specs
Returns:
List[str]: list of requirements items
CommandLine:
... | parse_requirements | python | iPERDance/iPERCore | setup.py | https://github.com/iPERDance/iPERCore/blob/master/setup.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.