repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
openatx/uiautomator2
import hashlib from unittest.mock import Mock, mock_open, patch import pytest from uiautomator2.core import BasicUiautomatorServer def mock_server(): """Create a mock BasicUiautomatorServer instance with a mock device""" mock_dev = Mock() with patch.object(BasicUiautomatorServer, '__init__', return_value...
True
assert
bool_literal
tests/test_core.py
test_toybox_md5sum_success
TestCheckDeviceFileHash
42
null
openatx/uiautomator2
import threading import time import pytest from PIL import Image from uiautomator2 import utils def test_naturalsize(): assert utils.natualsize(1) ==
"0.0 KB"
assert
string_literal
tests/test_utils.py
test_naturalsize
70
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 @pytest.mark.skip("Need fix") def test_implicitly_wait(d): d.implicitly_wait(2) assert d.implicitly_wait() == 2 start = time.time() with self.assertRaises(
u2.UiObjectNotFoundError)
self.assertRaises
complex_expr
mobile_tests/test_simple.py
test_implicitly_wait
107
null
openatx/uiautomator2
import random from pathlib import Path import pytest from PIL import Image import uiautomator2 as u2 def test_orientation(d: u2.Device): with pytest.raises(
ValueError)
pytest.raises
variable
demo_tests/test_device.py
test_orientation
86
null
openatx/uiautomator2
import time import pytest import uiautomator2 as u2 from uiautomator2 import Selector @pytest.mark.skip(reason="not stable") def test_child_by(app: u2.Device): app(text="Addition").click() app(text='Add').wait() time.sleep(.5) # childByText, childByInstance and childByDescription run query when calle...
u2.UiObjectNotFoundError)
pytest.raises
complex_expr
demo_tests/test_selector.py
test_child_by
40
null
openatx/uiautomator2
import hashlib from unittest.mock import Mock, mock_open, patch import pytest from uiautomator2.core import BasicUiautomatorServer def mock_server(): """Create a mock BasicUiautomatorServer instance with a mock device""" mock_dev = Mock() with patch.object(BasicUiautomatorServer, '__init__', return_value...
["toybox", "md5sum", "/data/local/tmp/u2.jar"]
assert
collection
tests/test_core.py
test_toybox_not_found_fallback_to_md5
TestCheckDeviceFileHash
70
null
openatx/uiautomator2
from unittest.mock import Mock import pytest from PIL import Image from uiautomator2.xpath import XMLElement, XPath, XPathElementNotFoundError, XPathEntry, XPathSelector, \ convert_to_camel_case, is_xpath_syntax_ok, safe_xmlstr, str2bytes, strict_xpath mock = Mock() mock.screenshot.return_value = Image.new("RGB"...
True
assert
bool_literal
tests/test_xpath.py
test_xpath_click
99
null
openatx/uiautomator2
import threading import time import pytest from PIL import Image from uiautomator2 import utils def test_inject_call(): def foo(a, b, c=2): return a*100+b*10+c ret = utils.inject_call(foo, a=2, b=4) assert ret ==
242
assert
numeric_literal
tests/test_utils.py
test_inject_call
30
null
openatx/uiautomator2
from unittest.mock import Mock, patch import pytest from uiautomator2._input import InputMethodMixIn from uiautomator2.exceptions import AdbBroadcastError def test_send_keys_hides_keyboard_when_using_custom_ime(): """Test that send_keys hides keyboard after successful input with custom IME""" mock_input = Mo...
"ADB_KEYBOARD_HIDE"
assert
string_literal
tests/test_input.py
test_send_keys_hides_keyboard_when_using_custom_ime
72
null
openatx/uiautomator2
import time import pytest import uiautomator2 as u2 from uiautomator2 import Selector def test_selector_magic(): s = Selector(text='123').child(text='456').sibling(text='789').clone() assert s['text'] == '123' del s['text'] assert 'text' not in
s
assert
variable
demo_tests/test_selector.py
test_selector_magic
16
null
openatx/uiautomator2
import pytest from uiautomator2 import Settings def test_settings(): settings = Settings(None) settings['wait_timeout'] = 10 assert settings['wait_timeout'] == 10 with pytest.raises(
TypeError)
pytest.raises
variable
tests/test_settings.py
test_settings
14
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 PACKAGE = "com.example.u2testdemo" def test_app_start_stop(d: u2.Device): assert PACKAGE in d.app_list() d.app_stop(PACKAGE) assert PACKAGE not in
d.app_list_running()
assert
func_call
demo_tests/test_app.py
test_app_start_stop
26
null
openatx/uiautomator2
import threading import time import pytest from PIL import Image from uiautomator2 import utils def test_threadsafe_wrapper(): class A: n = 0 @utils.thread_safe_wrapper def call(self): v = self.n time.sleep(.5) self.n = v + 1 a = A() th1 =...
a.n
assert
complex_expr
tests/test_utils.py
test_threadsafe_wrapper
54
null
openatx/uiautomator2
from unittest.mock import Mock import pytest from PIL import Image from uiautomator2.xpath import XMLElement, XPath, XPathElementNotFoundError, XPathEntry, XPathSelector, \ convert_to_camel_case, is_xpath_syntax_ok, safe_xmlstr, str2bytes, strict_xpath mock = Mock() mock.screenshot.return_value = Image.new("RGB"...
0
assert
numeric_literal
tests/test_xpath.py
test_xpath_all
130
null
openatx/uiautomator2
import threading import time import pytest from PIL import Image from uiautomator2 import utils def test_naturalsize(): assert utils.natualsize(1) == "0.0 KB" assert utils.natualsize(1024) == "1.0 KB" assert utils.natualsize(1<<20) ==
"1.0 MB"
assert
string_literal
tests/test_utils.py
test_naturalsize
72
null
openatx/uiautomator2
import time import pytest import uiautomator2 as u2 def test_set_xpath_debug(dev: u2.Device): with pytest.raises(
TypeError)
pytest.raises
variable
mobile_tests/test_settings.py
test_set_xpath_debug
12
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 @pytest.mark.skip("Need upgrade") def test_watchers(self): """ App -> Notification -> Status Bar """ d = self.sess d.watcher.remove() d.watcher.stop() d(text="App").click() d.xpath("Notification").wait() d.w...
d(text="Status Bar").wait(timeout=3))
self.assertTrue
func_call
mobile_tests/test_simple.py
test_watchers
55
null
openatx/uiautomator2
from unittest.mock import Mock import pytest from PIL import Image from uiautomator2.xpath import XMLElement, XPath, XPathElementNotFoundError, XPathEntry, XPathSelector, \ convert_to_camel_case, is_xpath_syntax_ok, safe_xmlstr, str2bytes, strict_xpath mock = Mock() mock.screenshot.return_value = Image.new("RGB"...
1
assert
numeric_literal
tests/test_xpath.py
test_xpath_all
132
null
openatx/uiautomator2
from unittest.mock import Mock, patch import pytest from uiautomator2._input import InputMethodMixIn from uiautomator2.exceptions import AdbBroadcastError def test_send_keys_hides_keyboard_when_using_custom_ime(): """Test that send_keys hides keyboard after successful input with custom IME""" mock_input = Mo...
2
assert
numeric_literal
tests/test_input.py
test_send_keys_hides_keyboard_when_using_custom_ime
65
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 def test_xpath(dev): d = dev d.xpath("//*[@text='Media']").wait() assert len(d.xpath("//*[@text='Media']").all()) ==
1
assert
numeric_literal
mobile_tests/test_simple.py
test_xpath
96
null
openatx/uiautomator2
from typing import Optional import uiautomator2 as u2 def get_app_process_pid(d: u2.Device) -> Optional[int]: for line in d.shell("ps -u shell").output.splitlines(): fields = line.split() if fields[-1] == 'app_process': pid = fields[1] return int(pid) return None def k...
0
assert
numeric_literal
demo_tests/test_core.py
test_uiautomator_keeper
33
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 PACKAGE = "com.example.u2testdemo" def test_session(d: u2.Device): app = d.session(PACKAGE) assert app.running() is
True
assert
bool_literal
demo_tests/test_app.py
test_session
48
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 from uiautomator2.exceptions import SessionBrokenError def test_session_app(dev: u2.Device, package_name): dev.app_start(package_name) assert dev.app_current()['package'] == package_name dev.app_wait(package_name) assert package_name in dev.app_list() asser...
False
assert
bool_literal
mobile_tests/test_session.py
test_session_app
47
null
openatx/uiautomator2
import threading from functools import partial import pytest import uiautomator2 as u2 def test_xpath_parent(dev: u2.Device): d = dev info = d.xpath("App").parent("@android:id/list").info assert info["resourceId"] ==
"android:id/list"
assert
string_literal
mobile_tests/test_xpath.py
test_xpath_parent
67
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 @pytest.mark.skip("TODO:: not fixed") def test_count(self): d = self.sess count = d(resourceId="android:id/list").child( className="android.widget.TextView").count self.assertEqual(count,
11)
self.assertEqual
numeric_literal
mobile_tests/test_simple.py
test_count
79
null
openatx/uiautomator2
import random from pathlib import Path import pytest from PIL import Image import uiautomator2 as u2 def test_clipboard(d: u2.Device): d.set_input_ime() text = str(random.randint(0, 1000)) d.clipboard = f'n{text}' assert d.clipboard ==
f'n{text}'
assert
string_literal
demo_tests/test_device.py
test_clipboard
123
null
openatx/uiautomator2
import random from pathlib import Path import pytest from PIL import Image import uiautomator2 as u2 def test_orientation(d: u2.Device): with pytest.raises(ValueError): d.orientation = 'unknown' d.orientation = 'n' assert d.orientation ==
'natural'
assert
string_literal
demo_tests/test_device.py
test_orientation
90
null
openatx/uiautomator2
import time import pytest import uiautomator2 as u2 from uiautomator2 import Selector def test_selector_magic(): s = Selector(text='123').child(text='456').sibling(text='789').clone() assert s['text'] ==
'123'
assert
string_literal
demo_tests/test_selector.py
test_selector_magic
14
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 PACKAGE = "com.example.u2testdemo" def test_session(d: u2.Device): app = d.session(PACKAGE) assert app.running() is True assert app.pid > 0 old_pid = app.pid app.restart() assert old_pid !=
app.pid
assert
complex_expr
demo_tests/test_app.py
test_session
53
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 @pytest.mark.skip("Need upgrade") def test_watchers(self): """ App -> Notification -> Status Bar """ d = self.sess d.watcher.remove() d.watcher.stop() d(text="App").click() d.xpath("Notification").wait() d.w...
d.watcher.running())
self.assertFalse
func_call
mobile_tests/test_simple.py
test_watchers
59
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 @pytest.mark.skip("TODO:: not fixed") def test_count(self): d = self.sess count = d(resourceId="android:id/list").child( className="android.widget.TextView").count self.assertEqual(count, 11) self.assertEqual( d(resou...
1)
self.assertEqual
numeric_literal
mobile_tests/test_simple.py
test_count
84
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 def test_send_keys(dev): d = dev d.xpath("App").click() d.xpath("Search").click() d.xpath('//*[@text="Invoke Search"]').click() d.xpath('@io.appium.android.apis:id/txt_query_prefill').click() d.send_keys("hello", clear=True) ...
'hello'
assert
string_literal
mobile_tests/test_simple.py
test_send_keys
146
null
openatx/uiautomator2
from unittest.mock import Mock import pytest from PIL import Image from uiautomator2.xpath import XMLElement, XPath, XPathElementNotFoundError, XPathEntry, XPathSelector, \ convert_to_camel_case, is_xpath_syntax_ok, safe_xmlstr, str2bytes, strict_xpath mock = Mock() mock.screenshot.return_value = Image.new("RGB"...
False
assert
bool_literal
tests/test_xpath.py
test_is_xpath_syntax_ok
47
null
openatx/uiautomator2
import os import cv2 import numpy as np import pytest from PIL import Image import uiautomator2.image as u2image TESTDIR = os.path.dirname(os.path.abspath(__file__)) + "/testdata" # if set to DIR__, pytest will fail with TypeError: 'str' object is not callable def path_ae86(): filepath = os.path.join(TESTDIR, "...
(409, 659)
assert
collection
mobile_tests/skip_test_image.py
test_image_match
69
null
openatx/uiautomator2
from unittest.mock import Mock, patch import pytest from uiautomator2._input import InputMethodMixIn from uiautomator2.exceptions import AdbBroadcastError def test_send_keys_hides_keyboard_when_using_custom_ime(): """Test that send_keys hides keyboard after successful input with custom IME""" mock_input = Mo...
broadcast_calls[0][1]
assert
complex_expr
tests/test_input.py
test_send_keys_hides_keyboard_when_using_custom_ime
69
null
openatx/uiautomator2
import hashlib from unittest.mock import Mock, mock_open, patch import pytest from uiautomator2.core import BasicUiautomatorServer def mock_server(): """Create a mock BasicUiautomatorServer instance with a mock device""" mock_dev = Mock() with patch.object(BasicUiautomatorServer, '__init__', return_value...
["toybox", "md5sum", "/data/local/tmp/u2.jar"])
assert_*
collection
tests/test_core.py
test_toybox_md5sum_success
TestCheckDeviceFileHash
44
null
openatx/uiautomator2
import time import pytest import uiautomator2 as u2 from uiautomator2 import Selector def test_screenshot(app: u2.Device): lx, ly, rx, ry = app(text="Addition").bounds() image = app(text="Addition").screenshot() assert image.size ==
(rx - lx, ry - ly)
assert
collection
demo_tests/test_selector.py
test_screenshot
50
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 @pytest.mark.skip("TODO:: not fixed") def test_select_iter(d): d(text='OS').click() texts = d(resourceId='android:id/list').child( className='android.widget.TextView') assert texts.count ==
4
assert
numeric_literal
mobile_tests/test_simple.py
test_select_iter
120
null
openatx/uiautomator2
import time import pytest import uiautomator2 as u2 def test_set_xpath_debug(dev: u2.Device): with pytest.raises(TypeError): dev.settings['xpath_debug'] = 1 dev.settings['xpath_debug'] = True assert dev.settings['xpath_debug'] == True dev.settings['xpath_debug'] = False assert dev....
False
assert
bool_literal
mobile_tests/test_settings.py
test_set_xpath_debug
19
null
openatx/uiautomator2
from unittest.mock import Mock import pytest from PIL import Image from uiautomator2.xpath import XMLElement, XPath, XPathElementNotFoundError, XPathEntry, XPathSelector, \ convert_to_camel_case, is_xpath_syntax_ok, safe_xmlstr, str2bytes, strict_xpath mock = Mock() mock.screenshot.return_value = Image.new("RGB"...
"n2"
assert
string_literal
tests/test_xpath.py
test_xpath_with_instance
90
null
openatx/uiautomator2
import hashlib from unittest.mock import Mock, mock_open, patch import pytest from uiautomator2.core import BasicUiautomatorServer def mock_server(): """Create a mock BasicUiautomatorServer instance with a mock device""" mock_dev = Mock() with patch.object(BasicUiautomatorServer, '__init__', return_value...
False
assert
bool_literal
tests/test_core.py
test_hash_mismatch
TestCheckDeviceFileHash
89
null
openatx/uiautomator2
import pytest from uiautomator2 import Settings def test_settings(): settings = Settings(None) settings['wait_timeout'] = 10 assert settings['wait_timeout'] == 10 with pytest.raises(TypeError): settings['wait_timeout'] = '30' assert settings['wait_timeout'] == 10 with pytest...
AttributeError)
pytest.raises
variable
tests/test_settings.py
test_settings
18
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 PACKAGE = "com.example.u2testdemo" def test_session(d: u2.Device): app = d.session(PACKAGE) assert app.running() is True assert app.pid >
0
assert
numeric_literal
demo_tests/test_app.py
test_session
49
null
openatx/uiautomator2
from unittest.mock import Mock, patch import pytest from uiautomator2._input import InputMethodMixIn from uiautomator2.exceptions import AdbBroadcastError def test_send_keys_hides_keyboard_when_using_custom_ime(): """Test that send_keys hides keyboard after successful input with custom IME""" mock_input = Mo...
True
assert
bool_literal
tests/test_input.py
test_send_keys_hides_keyboard_when_using_custom_ime
61
null
openatx/uiautomator2
import io import os import uiautomator2 as u2 def test_push_and_pull(d: u2.Device): device_target = "/data/local/tmp/hello.txt" content = b"hello world" d.push(io.BytesIO(content), device_target) d.pull(device_target, "tmpfile-hello.txt") with open("tmpfile-hello.txt", "rb") as f: assert...
content
assert
variable
mobile_tests/test_push_pull.py
test_push_and_pull
17
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 from uiautomator2.exceptions import SessionBrokenError def test_app_mixin(dev: u2.Device, package_name: str): assert package_name in dev.app_list() dev.app_stop(package_name) assert package_name not in
dev.app_list_running()
assert
func_call
mobile_tests/test_session.py
test_app_mixin
22
null
openatx/uiautomator2
import time import uiautomator2 as u2 def test_swipe_duration(d: u2.Device): w, h = d.window_size() start = time.time() d.swipe(w//2, h//2, w-1, h//2, 2.0) duration = time.time() - start assert duration >=
1.5
assert
numeric_literal
mobile_tests/test_swipe.py
test_swipe_duration
14
null
openatx/uiautomator2
import time import unittest import pytest import uiautomator2 as u2 @pytest.mark.skip("Need fix") def test_implicitly_wait(d): d.implicitly_wait(2) assert d.implicitly_wait() ==
2
assert
numeric_literal
mobile_tests/test_simple.py
test_implicitly_wait
105
null
openatx/uiautomator2
import threading import time import pytest from PIL import Image from uiautomator2 import utils def test_with_package_resource(): with utils.with_package_resource("assets/sync.sh") as asset_path: assert asset_path.exists() assert asset_path.is_file() assert asset_path.name ==
"sync.sh"
assert
string_literal
tests/test_utils.py
test_with_package_resource
98
null
openatx/uiautomator2
import threading import time import pytest from PIL import Image from uiautomator2 import utils def test_image_convert(): im = Image.new("RGB", (100, 100)) im2 = utils.image_convert(im, "pillow") assert isinstance(im2, Image.Image) with pytest.raises(
ValueError)
pytest.raises
variable
tests/test_utils.py
test_image_convert
81
null
openatx/uiautomator2
from unittest.mock import Mock import pytest from PIL import Image from uiautomator2.xpath import XMLElement, XPath, XPathElementNotFoundError, XPathEntry, XPathSelector, \ convert_to_camel_case, is_xpath_syntax_ok, safe_xmlstr, str2bytes, strict_xpath mock = Mock() mock.screenshot.return_value = Image.new("RGB"...
"n1"
assert
string_literal
tests/test_xpath.py
test_xpath_selector
79
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 def test_send_keys(app: u2.Device): app(text="Addition").click() num1 = app(className="android.widget.EditText", instance=0) num2 = app(className="android.widget.EditText", instance=1) result = app(className="android.widget.EditText", instance=2) num1.s...
chars
assert
variable
demo_tests/test_input.py
test_send_keys
30
null
openatx/uiautomator2
import time import pytest import uiautomator2 as u2 def test_wait_timeout(d: u2.Device): d.settings['wait_timeout'] = 19.0 assert d.wait_timeout == 19.0 d.settings['wait_timeout'] = 10 assert d.wait_timeout ==
10
assert
numeric_literal
mobile_tests/test_settings.py
test_wait_timeout
27
null
openatx/uiautomator2
import threading from functools import partial import pytest import uiautomator2 as u2 def test_element_all(dev: u2.Device): app = dev.xpath('//*[@text="App"]') assert app.wait() assert len(app.all()) ==
1
assert
numeric_literal
mobile_tests/test_xpath.py
test_element_all
40
null
openatx/uiautomator2
import time import pytest import uiautomator2 as u2 @pytest.mark.skip("deprecated") def test_screenrecord(d: u2.Device): import imageio with pytest.raises(
RuntimeError)
pytest.raises
variable
mobile_tests/test_screenrecord.py
test_screenrecord
14
null
openatx/uiautomator2
import time import pytest import uiautomator2 as u2 from uiautomator2 import Selector def test_selector_info(app: u2.Device): _info = app(text="Addition").info assert _info["text"] ==
"Addition"
assert
string_literal
demo_tests/test_selector.py
test_selector_info
29
null
openatx/uiautomator2
import pytest from uiautomator2 import Settings def test_settings(): settings = Settings(None) settings['wait_timeout'] = 10 assert settings['wait_timeout'] ==
10
assert
numeric_literal
tests/test_settings.py
test_settings
12
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 PACKAGE = "com.example.u2testdemo" def test_app_info(d: u2.Device): d.app_info(PACKAGE) with pytest.raises(
u2.AppNotFoundError)
pytest.raises
complex_expr
demo_tests/test_app.py
test_app_info
38
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 from uiautomator2.exceptions import SessionBrokenError def test_app_mixin(dev: u2.Device, package_name: str): assert package_name in dev.app_list() dev.app_stop(package_name) assert package_name not in dev.app_list_running() dev.app_start(package_name) asser...
current_info['pid']
assert
complex_expr
mobile_tests/test_session.py
test_app_mixin
28
null
openatx/uiautomator2
import logging import pytest from uiautomator2 import enable_pretty_logging def test_enable_pretty_logging(caplog: pytest.LogCaptureFixture): logger = logging.getLogger("uiautomator2") logger.info("should not be printed") enable_pretty_logging() logger.info("hello") enable_pretty_logging(log...
caplog.text
assert
complex_expr
tests/test_logger.py
test_enable_pretty_logging
25
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 PACKAGE = "com.example.u2testdemo" def test_app_start_stop(d: u2.Device): assert PACKAGE in
d.app_list()
assert
func_call
demo_tests/test_app.py
test_app_start_stop
24
null
openatx/uiautomator2
from unittest.mock import Mock import pytest from PIL import Image from uiautomator2.xpath import XMLElement, XPath, XPathElementNotFoundError, XPathEntry, XPathSelector, \ convert_to_camel_case, is_xpath_syntax_ok, safe_xmlstr, str2bytes, strict_xpath mock = Mock() mock.screenshot.return_value = Image.new("RGB"...
None
assert
none_literal
tests/test_xpath.py
test_xpath_selector
83
null
openatx/uiautomator2
import threading import time import pytest from PIL import Image from uiautomator2 import utils def test_list2cmdline(): testdata = [ [("echo", "hello"), "echo hello"], [("echo", "hello&world"), "echo 'hello&world'"], [("What's", "your", "name?"), """'What'"'"'s' your 'name?'"""], ...
expect
assert
variable
tests/test_utils.py
test_list2cmdline
22
null
openatx/uiautomator2
from unittest.mock import Mock import pytest from PIL import Image from uiautomator2.xpath import XMLElement, XPath, XPathElementNotFoundError, XPathEntry, XPathSelector, \ convert_to_camel_case, is_xpath_syntax_ok, safe_xmlstr, str2bytes, strict_xpath mock = Mock() mock.screenshot.return_value = Image.new("RGB"...
2
assert
numeric_literal
tests/test_xpath.py
test_xpath_all
129
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 def test_send_keys(app: u2.Device): app(text="Addition").click() num1 = app(className="android.widget.EditText", instance=0) num2 = app(className="android.widget.EditText", instance=1) result = app(className="android.widget.EditText", instance=2) num1.s...
"5"
assert
string_literal
demo_tests/test_input.py
test_send_keys
21
null
openatx/uiautomator2
import pytest import uiautomator2 as u2 def test_send_keys(app: u2.Device): app(text="Addition").click() num1 = app(className="android.widget.EditText", instance=0) num2 = app(className="android.widget.EditText", instance=1) result = app(className="android.widget.EditText", instance=2) num1.s...
''
assert
string_literal
demo_tests/test_input.py
test_send_keys
23
null
openatx/uiautomator2
from unittest.mock import Mock, patch import pytest from uiautomator2._input import InputMethodMixIn from uiautomator2.exceptions import AdbBroadcastError def test_send_keys_hides_keyboard_when_using_custom_ime(): """Test that send_keys hides keyboard after successful input with custom IME""" mock_input = Mo...
{}
assert
collection
tests/test_input.py
test_send_keys_hides_keyboard_when_using_custom_ime
73
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.io.inputs.argument import Argument def test_list_arguments_do_not_support_non_list_default_values() -> None: with
CleoLogicError, match="A default value for a list argument must be a list")
pytest.raises
complex_expr
tests/io/inputs/test_argument.py
test_list_arguments_do_not_support_non_list_default_values
53
null
python-poetry/cleo
from __future__ import annotations import re import pytest from cleo.io.buffered_io import BufferedIO from cleo.io.outputs.output import Verbosity from cleo.ui.exception_trace.component import ExceptionTrace from tests.fixtures.exceptions import nested1 from tests.fixtures.exceptions import nested2 from tests.fixtur...
Exception)
pytest.raises
variable
tests/ui/test_exception_trace.py
test_render_can_ignore_given_files
180
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.ui.confirmation_question import ConfirmationQuestion @pytest.mark.parametrize( ("input", "expected", "default"), [ ("", True, True), ("", False, False), ("y", True, True), ("yes", True...
expected
assert
variable
tests/ui/test_confirmation_question.py
test_ask
28
null
python-poetry/cleo
from __future__ import annotations import sys from typing import TYPE_CHECKING import pytest from cleo.io.inputs.argument import Argument from cleo.io.inputs.argv_input import ArgvInput from cleo.io.inputs.definition import Definition from cleo.io.inputs.option import Option def argv() -> Iterator[None]: origi...
["foo"]
assert
collection
tests/io/inputs/test_argv_input.py
test_it_uses_argv_by_default
33
null
python-poetry/cleo
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo.ui.question import Question def has_tty_available() -> bool: with Path(os.devnull).open("w", encoding="utf-8") as devnull: exit_code = subprocess.call(["stty"...
"white"
assert
string_literal
tests/ui/test_question.py
test_ask_and_validate
66
null
python-poetry/cleo
from __future__ import annotations from cleo.ui.exception_trace.inspector import Inspector from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import recursive_exception from tests.ui.exception_trace.helpers import simple_exception def test_inspector_with_recursive_exce...
"RecursionError"
assert
string_literal
tests/ui/exception_trace/test_inspector.py
test_inspector_with_recursive_exception
47
null
python-poetry/cleo
from __future__ import annotations import sys from typing import TYPE_CHECKING import pytest from cleo.io.inputs.argument import Argument from cleo.io.inputs.argv_input import ArgvInput from cleo.io.inputs.definition import Definition from cleo.io.inputs.option import Option def argv() -> Iterator[None]: origi...
expected_options
assert
variable
tests/io/inputs/test_argv_input.py
test_parse_options
153
null
python-poetry/cleo
from __future__ import annotations import inspect from pathlib import Path from cleo.ui.exception_trace.frame import Frame from tests.ui.exception_trace.helpers import nested_exception from tests.ui.exception_trace.helpers import simple_exception def test_frame() -> None: try: simple_exception() exc...
frame
assert
variable
tests/ui/exception_trace/test_frame.py
test_frame
36
null
python-poetry/cleo
from __future__ import annotations import os import sys from pathlib import Path import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.exceptions import CleoCommandNotFoundError from cleo.exceptions import CleoNamespaceNotFoundError from cleo.io.io import IO from...
"Baz"
assert
string_literal
tests/test_application.py
test_name_version_setter
61
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.io.outputs.output import Verbosity from cleo.ui.progress_bar import ProgressBar def bar(io: BufferedIO) -> ProgressBar: return ProgressBar(io, min_seconds_between_redraws=0) def ansi_bar(ansi_io: BufferedIO) -> Progress...
""
assert
string_literal
tests/ui/test_progress_bar.py
test_display_with_quiet_verbosity
198
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.io.inputs.argument import Argument def test_optional_non_list_argument() -> None: argument = Argument( "foo", required=False, is_list=False, description="Foo description", ...
"bar"
assert
string_literal
tests/io/inputs/test_argument.py
test_optional_non_list_argument
22
null
python-poetry/cleo
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo.ui.question import Question def has_tty_available() -> bool: with Path(os.devnull).open("w", encoding="utf-8") as devnull: exit_code = subprocess.call(["stty"...
Exception)
pytest.raises
variable
tests/ui/test_question.py
test_ask_and_validate
71
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.io.inputs.argument import Argument def test_required_arguments_do_not_support_default_values() -> None: with
CleoLogicError, match="Cannot set a default value for required arguments")
pytest.raises
complex_expr
tests/io/inputs/test_argument.py
test_required_arguments_do_not_support_default_values
46
null
python-poetry/cleo
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo.ui.question import Question def has_tty_available() -> bool: with Path(os.devnull).open("w", encoding="utf-8") as devnull: exit_code = subprocess.call(["stty"...
"not yet"
assert
string_literal
tests/ui/test_question.py
test_no_interaction
81
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.exceptions import CleoValueError from cleo.io.inputs.option import Option def test_multi_valued_with_default() -> None: opt = Option("option", flag=False, is_list=True, default=["foo", "bar"]) assert not op...
["foo", "bar"]
assert
collection
tests/io/inputs/test_option.py
test_multi_valued_with_default
123
null
python-poetry/cleo
from __future__ import annotations import os from typing import TYPE_CHECKING import pytest from cleo.terminal import Terminal @pytest.mark.parametrize( "columns_env_value, init_value, expected", ( ("314", None, 314), ("200", 40, 40), ("random", 40, 40), ("random", None, 80)...
expected
assert
variable
tests/test_terminal.py
test_columns_env
40
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.testers.command_tester import CommandTester from tests.fixtures.inherited_command import ChildC...
expected
assert
variable
tests/commands/test_command.py
test_overwrite
80
null
python-poetry/cleo
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo.ui.question import Question def has_tty_available() -> bool: with Path(os.devnull).open("w", encoding="utf-8") as devnull: exit_code = subprocess.call(["stty"...
"What time is it? "
assert
string_literal
tests/ui/test_question.py
test_ask
37
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar import pytest from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.testers.command_tester import CommandTester def tester() -> CommandTester: ...
"bar\n"
assert
string_literal
tests/testers/test_command_tester.py
test_execute
44
null
python-poetry/cleo
from __future__ import annotations import re import pytest from cleo.io.buffered_io import BufferedIO from cleo.io.outputs.output import Verbosity from cleo.ui.exception_trace.component import ExceptionTrace from tests.fixtures.exceptions import nested1 from tests.fixtures.exceptions import nested2 from tests.fixtur...
RuntimeError)
pytest.raises
variable
tests/ui/test_exception_trace.py
test_render_with_suppressed_context
375
null
python-poetry/cleo
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo.ui.question import Question def has_tty_available() -> bool: with Path(os.devnull).open("w", encoding="utf-8") as devnull: exit_code = subprocess.call(["stty"...
error
assert
variable
tests/ui/test_question.py
test_ask_and_validate
74
null
python-poetry/cleo
from __future__ import annotations from io import StringIO import pytest from cleo.io.outputs.section_output import SectionOutput def stream() -> StringIO: return StringIO() def sections() -> list[SectionOutput]: return [] def output(stream: StringIO, sections: list[SectionOutput]) -> SectionOutput: r...
"Foo\nBar\nBaz\nFooBar\n\x1b[2A\x1b[0J"
assert
string_literal
tests/io/outputs/test_section_output.py
test_clear_with_number_of_lines
45
null
python-poetry/cleo
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo.ui.question import Question def has_tty_available() -> bool: with Path(os.devnull).open("w", encoding="utf-8") as devnull: exit_code = subprocess.call(["stty"...
"2PM"
assert
string_literal
tests/ui/test_question.py
test_ask
32
null
python-poetry/cleo
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo._compat import WINDOWS from cleo.application import Application from cleo.testers.command_tester import CommandTester from tests.commands.completion.fixtures.command_with_colons import CommandWithColo...
ValueError)
pytest.raises
variable
tests/commands/completion/test_completions_command.py
test_invalid_shell
32
null
python-poetry/cleo
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo.ui.question import Question def has_tty_available() -> bool: with Path(os.devnull).open("w", encoding="utf-8") as devnull: exit_code = subprocess.call(["stty"...
"8AM"
assert
string_literal
tests/ui/test_question.py
test_ask
36
null
python-poetry/cleo
from __future__ import annotations from io import StringIO import pytest from cleo.io.outputs.section_output import SectionOutput def stream() -> StringIO: return StringIO() def sections() -> list[SectionOutput]: return [] def output(stream: StringIO, sections: list[SectionOutput]) -> SectionOutput: r...
"Foo\nBar\n\x1b[2A\x1b[0J"
assert
string_literal
tests/io/outputs/test_section_output.py
test_clear_all
36
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.exceptions import CleoValueError from cleo.io.inputs.option import Option def test_create() -> None: opt = Option("option") assert opt.name ==
"option"
assert
string_literal
tests/io/inputs/test_option.py
test_create
13
null
python-poetry/cleo
from __future__ import annotations import os from io import StringIO import pytest from cleo.io.outputs.stream_output import StreamOutput def stream() -> StringIO: return StringIO() @pytest.mark.parametrize( ["env", "is_decorated"], [ ({"NO_COLOR": "1"}, False), ({"FORCE_COLOR": "1"}, ...
is_decorated
assert
variable
tests/io/outputs/test_stream_output.py
test_is_decorated_respects_environment
33
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar from cleo.application import Application from cleo.commands.command import Command from cleo.helpers import argument from cleo.testers.command_tester import CommandTester from tests.fixtures.inherited_command import ChildC...
application
assert
variable
tests/commands/test_command.py
test_set_application
53
null
python-poetry/cleo
from __future__ import annotations import os import subprocess from pathlib import Path from typing import TYPE_CHECKING import pytest from cleo.ui.question import Question def has_tty_available() -> bool: with Path(os.devnull).open("w", encoding="utf-8") as devnull: exit_code = subprocess.call(["stty"...
"2PMë"
assert
string_literal
tests/ui/test_question.py
test_ask_question_with_special_characters
88
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.ui.table import Table from cleo.ui.table_cell import TableCell from cleo.ui.table_separator import TableSeparator from cleo.ui.table_style import TableStyle books = [ ["99921-58-10-7", "Divine Comedy", "Dante Alighieri"]...
expected
assert
variable
tests/ui/test_table.py
test_render
428
null
python-poetry/cleo
from __future__ import annotations from typing import TYPE_CHECKING import pytest from cleo.exceptions import CleoValueError from cleo.ui.choice_question import ChoiceQuestion def test_ask_choice(io: BufferedIO) -> None: io.set_user_input("\n1\n 1 \nJohn\n1\n\nJohn\n1\n0,2\n 0 , 2 \n\n\n4\n0\n-2\n") her...
None
assert
none_literal
tests/ui/test_choice_question.py
test_ask_choice
39
null
python-poetry/cleo
from __future__ import annotations import pytest from cleo.exceptions import CleoLogicError from cleo.io.inputs.argument import Argument def test_list_argument() -> None: argument = Argument("foo", is_list=True, description="Foo description") assert argument.name == "foo" assert argument.is_required() ...
[]
assert
collection
tests/io/inputs/test_argument.py
test_list_argument
42
null