How to use test_delete method in uiautomator

Best Python code snippet using uiautomator

test_14_delete.py

Source:test_14_delete.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2#!/usr/bin/env python3#4# Copyright 2015-2022 BigML5#6# Licensed under the Apache License, Version 2.0 (the "License"); you may7# not use this file except in compliance with the License. You may obtain8# a copy of the License at9#10# http://www.apache.org/licenses/LICENSE-2.011#12# Unless required by applicable law or agreed to in writing, software13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the15# License for the specific language governing permissions and limitations16# under the License.17""" Testing delete subcommand18"""19from bigmler.tests.world import (world, common_setup_module,20 common_teardown_module, teardown_class)21import bigmler.tests.basic_tst_prediction_steps as test_pred22import bigmler.tests.delete_subcommand_steps as test_delete23def setup_module():24 """Setup for the module25 """26 common_setup_module()27def teardown_module():28 """Teardown for the module29 """30 common_teardown_module()31class TestDelete(object):32 def teardown(self):33 """Calling generic teardown for every method34 """35 print("\nEnd of tests in: %s\n-------------------\n" % __name__)36 teardown_class()37 def setup(self):38 """39 Debug information40 """41 print("\n-------------------\nTests in: %s\n" % __name__)42 def test_scenario1(self):43 """44 Scenario: Successfully deleting a source by id:45 Given I create a BigML source from file "<data>" storing results in "<output_dir>"46 And I check that the source exists47 And I delete the source by id using --ids storing results in "<output_dir>"48 Then I check that the source doesn't exist49 Examples:50 | data | output_dir |51 | ../data/iris.csv | ./scenario_del_1 |52 """53 print(self.test_scenario1.__doc__)54 examples = [55 ['data/iris.csv', 'scenario_del_1']]56 for example in examples:57 print("\nTesting with:\n", example)58 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[1])59 test_delete.i_check_source_exists(self)60 test_delete.i_delete_source_by_ids(self, output_dir=example[1])61 test_delete.i_check_source_does_not_exist(self, source_id=None)62 def test_scenario2(self):63 """64 Scenario: Failing deleting a source by id when --dry-run is used:65 Given I create a BigML source from file "<data>" storing results in "<output_dir>"66 And I check that the source has been created67 And I delete the source by id using --ids and --dry-run storing results in "<output_dir>"68 Then I check that the source exists69 Examples:70 | data | output_dir |71 | ../data/iris.csv | ./scenario_del_2 |72 """73 print(self.test_scenario2.__doc__)74 examples = [75 ['data/iris.csv', 'scenario_del_2']]76 for example in examples:77 print("\nTesting with:\n", example)78 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[1])79 test_pred.i_check_create_source(self)80 test_delete.i_delete_source_by_ids_dry(self, output_dir=example[1])81 test_delete.i_check_source_exists(self)82 def test_scenario3(self):83 """84 Scenario: Failing deleting a source by id when a different resource_types is used:85 Given I create a BigML source from file "<data>" storing results in "<output_dir>"86 And I check that the source has been created87 And I delete the source by id using --ids and --resource-types "<resource_types>" storing results in "<output_dir>"88 Then I check that the source exists89 Examples:90 | data | output_dir | resource_types91 | ../data/iris.csv | ./scenario_del_3 | dataset,model92 """93 print(self.test_scenario3.__doc__)94 examples = [95 ['data/iris.csv', 'scenario_del_3', 'dataset,model']]96 for example in examples:97 print("\nTesting with:\n", example)98 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[1])99 test_pred.i_check_create_source(self)100 test_delete.i_delete_source_by_ids_filtered(self, resource_types=example[2], output_dir=example[1])101 test_delete.i_check_source_exists(self)102 def test_scenario4(self):103 """104 Scenario: Successfully deleting a source from a file:105 Given I create a BigML source from file "<data>" storing results in "<output_dir>"106 And I check that the source exists107 And I delete the source by id using --from-file and the source file storing results in "<output_dir>"108 Then I check that the source doesn't exist109 Examples:110 | data | output_dir |111 | ../data/iris.csv | ./scenario_del_4 |112 """113 print(self.test_scenario4.__doc__)114 examples = [115 ['data/iris.csv', 'scenario_del_4']]116 for example in examples:117 print("\nTesting with:\n", example)118 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[1])119 test_delete.i_check_source_exists(self)120 test_delete.i_delete_source_by_file(self, output_dir=example[1])121 test_delete.i_check_source_does_not_exist(self, source_id=None)122 def test_scenario5(self):123 """124 Scenario: Failing deleting a source from a file when a different resource_types is used:125 Given I create a BigML source from file "<data>" storing results in "<output_dir>"126 And I check that the source has been created127 And I delete the source by id using --from-file, the source file and --resource-types "<resource_types>" storing results in "<output_dir>"128 Then I check that the source exists129 Examples:130 | data | output_dir | resource_types131 | ../data/iris.csv | ./scenario_del_5 | dataset,model132 """133 print(self.test_scenario5.__doc__)134 examples = [135 ['data/iris.csv', 'scenario_del_5', 'dataset,model']]136 for example in examples:137 print("\nTesting with:\n", example)138 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[1])139 test_pred.i_check_create_source(self)140 test_delete.i_delete_source_by_file_filtered(self, resource_types=example[2], output_dir=example[1])141 test_delete.i_check_source_exists(self)142 def test_scenario6(self):143 """144 Scenario: Sucessfully deleting a source in a time range:145 Given I create a BigML source from file "<data>" storing results in "<output_dir>"146 And I check that the source has been created147 And I store the source id as lower148 And I create a BigML source from file "<data>" storing results in "<output_dir2>"149 And I check that the source exists150 And I store the source id as reference151 And I create a BigML source from file "<data>" storing results in "<output_dir3>"152 And I check that the source has been created153 And I store the source id as upper154 And I delete the source using --older-than and --newer-than storing results in "<output_dir>"155 Then I check that the reference source doesn't exist156 Examples:157 | data | output_dir | output_dir2 | output_dir3158 | ../data/iris.csv | ./scenario_del_6 | ./scenario_del_6_2 | ./scenario_del_6_3159 """160 print(self.test_scenario6.__doc__)161 examples = [162 ['data/iris.csv', 'scenario_del_6', 'scenario_del_6_2', 'scenario_del_6_3']]163 for example in examples:164 print("\nTesting with:\n", example)165 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[1])166 test_pred.i_check_create_source(self)167 test_delete.i_store_source_id_as_bound(self, which='lower')168 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[2])169 test_delete.i_check_source_exists(self)170 test_delete.i_store_source_id_as_bound(self, which='reference')171 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[3])172 test_pred.i_check_create_source(self)173 test_delete.i_store_source_id_as_bound(self, which='upper')174 test_delete.i_delete_source_older_newer(self, output_dir=example[3])175 test_delete.i_check_source_does_not_exist(self, source_id=world.source_reference)176 def test_scenario7(self):177 """178 Scenario: Failing deleting a source in a time range when a different resource_types is used:179 Given I create a BigML source from file "<data>" storing results in "<output_dir>"180 And I check that the source has been created181 And I store the source id as lower182 And I create a BigML source from file "<data>" storing results in "<output_dir2>"183 And I check that the source has been created184 And I store the source id as reference185 And I create a BigML source from file "<data>" storing results in "<output_dir3>"186 And I check that the source has been created187 And I store the source id as upper188 And I delete the source using --older-than and --newer-than with resource_types "<resource_types>" storing results in "<output_dir>"189 Then I check that the reference source exists190 Examples:191 | data | output_dir | resource_types| output_dir2 | output_dir3192 | ../data/iris.csv | ./scenario_del_7 | dataset,model | ./scenario_del_7_2 | ./scenario_del_7_3193 """194 print(self.test_scenario7.__doc__)195 examples = [196 ['data/iris.csv', 'scenario_del_7', 'dataset,model', 'scenario_del_7_2', 'scenario_del_7_3']]197 for example in examples:198 print("\nTesting with:\n", example)199 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[1])200 test_pred.i_check_create_source(self)201 test_delete.i_store_source_id_as_bound(self, which='lower')202 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[3])203 test_pred.i_check_create_source(self)204 test_delete.i_store_source_id_as_bound(self, which='reference')205 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[4])206 test_pred.i_check_create_source(self)207 test_delete.i_store_source_id_as_bound(self, which='upper')208 test_delete.i_delete_source_older_newer_with_resource_types(self, resource_types=example[2], output_dir=example[1])209 test_delete.i_check_source_exists_by_id(self, source_id=world.source_reference)210 def test_scenario8(self):211 """212 Scenario: Sucessfully deleting a source in a time range and with a tag:213 Given I create a BigML source from file "<data>" storing results in "<output_dir>"214 And I check that the source has been created215 And I store the source id as lower216 And I create a BigML source from file "<data>" with tag "<tag1>" storing results in "<output_dir>"217 And I check that the source exists218 And I store the source id as reference219 And I create a BigML source from file "<data>" with tag "<tag2>" storing results in "<output_dir2>"220 And I check that the source has been created221 And I store the source id as upper222 And I delete the source using --newer-than and --source-tag "<tag1>" storing results in "<output_dir3>"223 Then I check that the reference source doesn't exist224 And I check that the upper source exists225 Examples:226 | data | output_dir | tag1 | tag2 | output_dir2 | output_dir3227 | ../data/iris.csv | ./scenario_del_8 | my_tag1 | my_tag2 | ./scenario_del_8_2 | ./scenario_del_8_3228 """229 print(self.test_scenario8.__doc__)230 examples = [231 ['data/iris.csv', 'scenario_del_8', 'my_tag1', 'my_tag2', 'scenario_del_8_2', 'scenario_del_8_3']]232 for example in examples:233 print("\nTesting with:\n", example)234 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[1])235 test_pred.i_check_create_source(self)236 test_delete.i_store_source_id_as_bound(self, which='lower')237 test_delete.i_create_source_from_file_with_tag(self, data=example[0], tag=example[2], output_dir=example[4])238 test_delete.i_check_source_exists(self)239 test_delete.i_store_source_id_as_bound(self, which='reference')240 test_delete.i_create_source_from_file_with_tag(self, data=example[0], tag=example[3], output_dir=example[5])241 test_pred.i_check_create_source(self)242 test_delete.i_store_source_id_as_bound(self, which='upper')243 test_delete.i_delete_source_newer_and_tag(self, tag=example[2], output_dir=example[1])244 test_delete.i_check_source_does_not_exist(self, source_id=world.source_reference)245 test_delete.i_check_source_exists_by_id(self, source_id=world.source_upper)246 def test_scenario9(self):247 """248 Scenario: Sucessfully deleting resources in a time range and with a tag:249 Given I create a BigML source from file "<data>" storing results in "<output_dir>"250 And I check that the source has been created251 And I store the source id as lower252 And I create a BigML source from file "<data>" with tag "<tag1>" storing results in "<output_dir>"253 And I check that the source exists254 And I create a BigML dataset from the source with tag "<tag1>" storing results in "<output_dir2>"255 And I check that the dataset exists256 And I delete the resources using --newer-than and --all-tag "<tag1>" storing results in "<output_dir3>"257 Then I check that the source doesn't exist258 And I check that the dataset doesn't exist259 Examples:260 | data | output_dir | tag1 | output_dir2 | output_dir3261 | ../data/iris.csv | ./scenario_del_9 | my_tag1 | ./scenario_del_9_2 | ./scenario_del_9_3262 """263 print(self.test_scenario9.__doc__)264 examples = [265 ['data/iris.csv', 'scenario_del_9', 'my_tag1', 'scenario_del_9_2', 'scenario_del_9_3']]266 for example in examples:267 print("\nTesting with:\n", example)268 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[1])269 test_pred.i_check_create_source(self)270 test_delete.i_store_source_id_as_bound(self, which='lower')271 test_delete.i_create_source_from_file_with_tag(self, data=example[0], tag=example[2], output_dir=example[3])272 test_delete.i_check_source_exists(self)273 test_delete.i_store_source_id_as_bound(self, which='reference')274 test_delete.i_create_dataset_from_source_with_tag(self, tag=example[2], output_dir=example[4])275 test_delete.i_check_dataset_exists(self)276 test_delete.i_delete_resources_newer_and_tag(self, tag=example[2], output_dir=example[1])277 test_delete.i_check_source_does_not_exist(self, source_id=world.source_reference)278 test_delete.i_check_dataset_does_not_exist(self, dataset_id=world.dataset)279 test_delete.i_check_source_exists_by_id(self, source_id=world.source_lower)280 def test_scenario10(self):281 """282 Scenario: Sucessfully deleting a source in a time range and with a tag:283 Given I create a BigML source from file "<data>" storing results in "<output_dir>"284 And I check that the source has been created285 And I store the source id as lower286 And I create a BigML source from file "<data>" with tag "<tag1>" storing results in "<output_dir>"287 And I check that the source exists288 And I store the source id as reference289 And I create a BigML source from file "<data2>" with tag "<tag2>" storing results in "<output_dir2>"290 And I check that the failed source exists291 And I delete the source using --newer-than and --source-tag "<tag1>" and --status faulty storing results in "<output_dir3>"292 Then I check that the reference source doesn't exist293 And I check that the upper source exists294 Examples:295 | data | output_dir | data2 | tag1 | tag2 | output_dir2 | output_dir3296 | ../data/iris.csv | ./scenario_del_8 | ../data/faulty.csv |my_tag1 | my_tag2 | ./scenario_del_8_2 | ./scenario_del_8_3297 """298 print(self.test_scenario10.__doc__)299 examples = [300 ['data/iris.csv', 'scenario_del_10', 'my_tag1', 'my_tag2', 'scenario_del_10_2', 'scenario_del_10_3', 'data/faulty.csv']]301 for example in examples:302 print("\nTesting with:\n", example)303 test_delete.i_create_source_from_file(self, data=example[0], output_dir=example[1])304 test_pred.i_check_create_source(self)305 test_delete.i_store_source_id_as_bound(self, which='lower')306 test_delete.i_create_faulty_source_from_file_with_tag(self, data=example[6], tag=example[2], output_dir=example[4])307 test_delete.i_check_faulty_source_exists(self)308 test_delete.i_store_source_id_as_bound(self, which='reference')309 test_delete.i_delete_source_newer_faulty_and_tag(self, tag=example[2], output_dir=example[1])310 test_delete.i_check_source_does_not_exist(self, source_id=world.source_reference)...

Full Screen

Full Screen

binary_tree_tests.py

Source:binary_tree_tests.py Github

copy

Full Screen

1from binary_tree import add, remove, find2def test_add():3 tree = None4 tree = add(tree, 1)5 tree = add(tree, 2)6 tree = add(tree, 3)7 if find(tree, 1) is False:8 print("test_add failed: can't find value 1")9 elif find(tree, 2) is False:10 print("test_add failed: can't find value 2")11 elif find(tree, 3) is False:12 print("test_add failed: can't find value 3")13 else:14 return True15def test_remove():16 tree = None17 tree = add(tree, 4)18 tree = add(tree, 2)19 tree = add(tree, 7)20 21 if find(tree, 2) is False:22 print("test_delete failed: can't find value 2")23 24 tree = remove(tree, 2)25 26 if find(tree, 2) is True:27 print("test_delete failed: 2 must be deleted")28 if find(tree, 4) is False:29 print("test_delete failed: 2 must be deleted")30 if find(tree, 7) is False:31 print("test_delete failed: 2 must be deleted")32 else:33 return True34def test_root_remove1():35 tree = None36 tree = add(tree, 5)37 tree = add(tree, 7)38 tree = add(tree, 6)39 tree = add(tree, 8)40 tree = add(tree, 2)41 42 if find(tree, 7) is False:43 print("test_delete failed: can't find value 7")44 45 tree = remove(tree, 7)46 47 if find(tree, 7) is True:48 print("test_delete failed: 7 must be deleted")49 elif find(tree, 5) is False:50 print("test_delete failed: can't find 2")51 elif find(tree, 6) is False:52 print("test_delete failed: can't find 2") 53 elif find(tree, 8) is False:54 print("test_delete failed: can't find 2")55 elif find(tree, 2) is False:56 print("test_delete failed: can't find 2")57 else:58 return True59def test_root_remove2():60 tree = None61 tree = add(tree, 5)62 tree = add(tree, 7)63 tree = add(tree, 6)64 tree = add(tree, 8)65 tree = add(tree, 2)66 67 if find(tree, 5) is False:68 print("test_delete failed: can't find value 5")69 70 tree = remove(tree, 5)71 72 if find(tree, 5) is True:73 print("test_delete failed: 5 must be deleted")74 elif find(tree, 7) is False:75 print("test_delete failed: can't find 2")76 elif find(tree, 6) is False:77 print("test_delete failed: can't find 2") 78 elif find(tree, 8) is False:79 print("test_delete failed: can't find 2")80 elif find(tree, 2) is False:81 print("test_delete failed: can't find 2")82 else:83 return True84if __name__ == '__main__':85 test_add()86 test_remove()87 test_root_remove1()88 test_root_remove2()89 if test_add() and test_remove() and test_root_remove1() and test_root_remove2():...

Full Screen

Full Screen

test_delete.py

Source:test_delete.py Github

copy

Full Screen

1import pytest2from fastapi.testclient import TestClient3from app.main import app4client = TestClient(app)5#sprinkler6@pytest.mark.order(4)7def test_delete_sprinkler(test_delete):8 response = test_delete.delete("/sprinkler/1")9 assert response.status_code == 20410@pytest.mark.order(4)11def test_delete_sprinkler_check_was_deleted(test_delete):12 response = test_delete.delete("/sprinkler/1")13 assert response.status_code == 40414@pytest.mark.order(4)15def test_delete_sprinkler_inexist_id(test_delete):16 response = test_delete.delete("/sprinkler/0")17 assert response.status_code == 40418 assert response.json()["message"] == "Don't find ID specified"19@pytest.mark.order(4)20def test_delete_sprinkler_wrong_value(test_delete):21 response = test_delete.delete("/sprinkler/wrong")22 assert response.status_code == 42223#plant24@pytest.mark.order(4)25def test_delete_plant(test_delete):26 response = test_delete.delete("/plant/1")27 assert response.status_code == 20428@pytest.mark.order(4)29def test_delete_plant_check_was_deleted(test_delete):30 response = test_delete.delete("/plant/1")31 assert response.status_code == 40432@pytest.mark.order(4)33def test_delete_plant_inexist_id(test_delete):34 response = test_delete.delete("/plant/0")35 assert response.status_code == 40436 assert response.json()["message"] == "Don't find ID specified"37@pytest.mark.order(4)38def test_delete_plant_wrong_value(test_delete):39 response = test_delete.delete("/plant/wrong")40 assert response.status_code == 42241#waterday42@pytest.mark.order(4)43def test_delete_waterday(test_delete):44 response = test_delete.delete("/waterday/1")45 assert response.status_code == 20446@pytest.mark.order(4)47def test_delete_waterday_check_was_deleted(test_delete):48 response = test_delete.delete("/waterday/1")49 assert response.status_code == 40450@pytest.mark.order(4)51def test_delete_waterday_inexist_id(test_delete):52 response = test_delete.delete("/waterday/0")53 assert response.status_code == 40454 assert response.json()["message"] == "Don't find ID specified"55@pytest.mark.order(4)56def test_delete_waterday_wrong_value(test_delete):57 response = test_delete.delete("/waterday/wrong")...

Full Screen

Full Screen

test_suite.py

Source:test_suite.py Github

copy

Full Screen

1import unittest2from test_db_basic import TestDbBasic3from test_db_dish import TestDbDish4from test_db_dishcomment import TestDbDishComment5from test_db_dishtype import TestDbDishType6from test_db_orderlist import TestDbOrderList7from test_db_qrlink import TestDbQRLink8from test_db_recommendation import TestDbRecommendation9from test_db_recommendationdetails import TestDbRecommendationDetails10from test_db_restaurant import TestDbRestaurant11from test_db_restauranttable import TestDbRestaurantTable1213if __name__ == '__main__':14 suite = unittest.TestSuite()1516 suite.addTests([TestDbRestaurant('test_insert'), TestDbRestaurant('test_delete')])17 suite.addTests([TestDbDishType('test_insert'), TestDbDishType('test_delete')])18 suite.addTests([TestDbRestaurantTable('test_insert'), TestDbRestaurantTable('test_delete')])19 suite.addTests([TestDbQRLink('test_insert'), TestDbQRLink('test_delete')])20 suite.addTests([TestDbDish('test_insert'), TestDbDish('test_delete')])21 suite.addTests([TestDbDishComment('test_insert'), TestDbDishComment('test_delete')])22 suite.addTests([TestDbOrderList('test_insert'), TestDbOrderList('test_delete')])23 suite.addTests([TestDbRecommendation('test_insert'), TestDbRecommendation('test_delete')])24 suite.addTests([TestDbRecommendationDetails('test_insert'), TestDbRecommendationDetails('test_delete')])25 suite.addTests([TestDbBasic('test_select'), TestDbBasic('test_update')])26 27 with open('UnittestTextReport.txt', 'w') as f:28 runner = unittest.TextTestRunner(stream=f, verbosity=2) ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run uiautomator automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful