Fix Python code format check issues
This commit is contained in:
1 parent
70be3c37e5
commit
3047c9c20a
15 files changed
+3155
-3039
No files matched your search
@@ -4,7 +4,6 @@ from artemis.clients.accessibility_client import AccessibilityClient, DEFAULT_PO
|
||||
|
||||
|
||||
class TestAccessibilityClient(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.client = AccessibilityClient(device_id="dummy_device", local_port=DEFAULT_PORT)
|
||||
|
||||
@@ -38,7 +37,7 @@ class TestAccessibilityClient(unittest.TestCase):
|
||||
@patch("artemis.clients.accessibility_client.urllib.request.urlopen")
|
||||
def test_get_hierarchy_xml(self, mock_urlopen):
|
||||
mock_resp = MagicMock()
|
||||
mock_resp.read.return_value = b"<hierarchy rotation=\"0\"><node text=\"Save\" /></hierarchy>"
|
||||
mock_resp.read.return_value = b'<hierarchy rotation="0"><node text="Save" /></hierarchy>'
|
||||
mock_resp.__enter__.return_value = mock_resp
|
||||
mock_urlopen.return_value = mock_resp
|
||||
|
||||
@@ -52,7 +51,7 @@ class TestAccessibilityClient(unittest.TestCase):
|
||||
"success": True,
|
||||
"has_screenshot": True,
|
||||
"screenshot_base64": "dummy_b64",
|
||||
"xml": "<hierarchy rotation=\"0\"><node text=\"OK\" /></hierarchy>",
|
||||
"xml": '<hierarchy rotation="0"><node text="OK" /></hierarchy>',
|
||||
"elements": [{"text": "OK"}],
|
||||
"width": 1080,
|
||||
"height": 2400,
|
||||
@@ -61,7 +60,7 @@ class TestAccessibilityClient(unittest.TestCase):
|
||||
self.assertEqual(screen_data.width, 1080)
|
||||
self.assertEqual(screen_data.height, 2400)
|
||||
self.assertEqual(screen_data.base64, "dummy_b64")
|
||||
self.assertIn("rotation=\"0\"", screen_data.hierarchy_xml)
|
||||
self.assertIn('rotation="0"', screen_data.hierarchy_xml)
|
||||
self.assertEqual(len(screen_data.elements), 1)
|
||||
|
||||
@patch.object(AccessibilityClient, "get_atomic_snapshot", return_value=None)
|
||||
@@ -69,10 +68,11 @@ class TestAccessibilityClient(unittest.TestCase):
|
||||
@patch.object(AccessibilityClient, "get_hierarchy")
|
||||
def test_get_screen_data_fallback(self, mock_get_hierarchy, mock_get_screenshot, _mock_atomic):
|
||||
from PIL import Image
|
||||
|
||||
mock_get_screenshot.return_value = Image.new("RGB", (1080, 2400))
|
||||
mock_get_hierarchy.return_value = {
|
||||
"success": True,
|
||||
"xml": "<hierarchy rotation=\"0\"><node text=\"Fallback\" /></hierarchy>",
|
||||
"xml": '<hierarchy rotation="0"><node text="Fallback" /></hierarchy>',
|
||||
"elements": [{"text": "Fallback"}],
|
||||
}
|
||||
|
||||
@@ -85,4 +85,3 @@ class TestAccessibilityClient(unittest.TestCase):
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in new issue
Block a user