Best Python code snippet using tox_python
test_getAbsPath.py
Source:test_getAbsPath.py
1#!/usr/bin/env python32from config import *3from src.get_abs_path import get_abs_path4from tests.Tests import Tests5'''6 THIS IS A GOOD PLACE FOR DOCUMENTATION7'''8def test_getPath():9 f = 'just_a_string.txt'10 try:11 foo = get_abs_path(f, **{'isQuite':True})12 return True13 except Error as e:14 LOGGER.warning('\n\tFAILED TEST 200')15 return False16def test_badpath1():17 bp = '/FAKE_FILE.TRASH'18 if get_abs_path(bp, **{'isQuite':True}) == "":19 return True20 bp = './FAKE_FILE.TRASH'21 if get_abs_path(bp, **{'isQuite':True}) == "":22 return True23 bp = 'FAKE_FILE.TRASH'24 if get_abs_path(bp, **{'isQuite':True}) == "":25 return True26 bp = '/Users/FAKE_FILE.TRASH'27 if get_abs_path(bp, **{'isQuite':True}) == "":28 return True29 LOGGER.warning('\n\tFAILED TEST 209')30 return False31def test_badpath2():32 bp = '/FAKE_DIR'33 if get_abs_path(bp, **{'isQuite':True}) == "":34 return True35 bp = '/FAKE_DIR/'36 if get_abs_path(bp, **{'isQuite':True}) == "":37 return True38 bp = '~/FAKE_DIR'39 if get_abs_path(bp, **{'isQuite':True}) == "":40 return True41 bp = 'FAKE_DIR'42 if get_abs_path(bp, **{'isQuite':True}) == "":43 return True44 LOGGER.warning('\n\tFAILED TEST 219')45 return False46def test_goodpath1():47 bp = '~/.pylog/README.txt'48 if get_abs_path(bp, **{'isQuite':True}) == "":49 LOGGER.warning('\n\tFAILED TEST 228')50 return False51 bp = 'tests/Tests.py'52 if get_abs_path(bp, **{'isQuite':True}) == "":53 LOGGER.warning('\n\tFAILED TEST 227')54 return False55 bp = '/Users/tannerleewoody/.pylog/README.txt'56 if get_abs_path(bp, **{'isQuite':True}) == "":57 LOGGER.warning('\n\tFAILED TEST 226')58 return False59 bp = HOME + '/.pylog/README.txt'60 if get_abs_path(bp, **{'isQuite':True}) == "":61 LOGGER.warning('\n\tFAILED TEST 225')62 return False63 return True64def test_goodpath2():65 bp = '~/.pylog/'66 if get_abs_path(bp, **{'isQuite':True}) == "":67 LOGGER.warning('\n\tFAILED TEST 231')68 return False69 bp = './tests/'70 if get_abs_path(bp, **{'isQuite':True}) == "":71 LOGGER.warning('\n\tFAILED TEST 232')72 return False73 bp = '/Users/tannerleewoody/.pylog/'74 if get_abs_path(bp, **{'isQuite':True}) == "":75 LOGGER.warning('\n\tFAILED TEST 233')76 return False77 bp = HOME + '/.pylog/README.txt'78 if get_abs_path(bp, **{'isQuite':True}) == "":79 LOGGER.warning('\n\tFAILED TEST 235')80 return False81 return True82def tests():83 #TODO: test ./ ../ ../file.txt ./file.txt etc.84 mod = "get_abs_path.py" #module85 ts = [86 test_getPath(),87 test_badpath1(),88 test_badpath2(),89 test_goodpath1(),90 test_goodpath2(),91 ]92 T = Tests(ts, mod)93 #T.pprint(**{'isQuite':True})94 T.pprint()95if __name__ == "__main__":...
start.py
Source:start.py
1# encoding=utf-82from GR1.APPMBT.core import util3from graph import Graph as gra4from appium import webdriver5import unittest6class APPMBT(unittest.TestCase):7 def setUp(self):8 desired_caps = {9 'platformName': 'Android',10 #æ¤å¤å¡«åæºå¨çandroidçæ¬11 'platformVersion': '4.4.4',12 #å¡«åadb devices -l ä¸æ¾ç¤ºç第ä¸åç设å¤å·13 'deviceName': '192.168.146.101:5555',14 'appPackage': 'com.huawei.appmarket',15 'appActivity': '.MainActivity',16 'appWaitActivity': '.MarketActivity',17 'noReset':True,18 'unicodeKeyboard': True,19 'resetKeyboard': True20 }21 self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)22 self.verificationErrors = []23 util.initGraph()24 # def test_randomPath(self):25 # try:26 # # util.randomPathWalk(self)27 # except Exception as err:28 # print err.message29 # self.assertTrue(False)30 def test_getPath(self):31 try:32 logs = util.createMainLog('E:\\worksplace\\GR1\APPMBT\\tests\\results\\')33 logs.debug("test_getPath----start!!!!!!!")34 util.getPathWalk(self)35 print util.getTestDataraw()36 except Exception as err:37 logs = util.createMainLog('E:\\worksplace\\GR1\APPMBT\\tests\\results\\')38 logs.debug("test_getPath----error!!!!!!!")39 print err.message40 self.assertTrue(False)41 def tearDown(self):42 self.driver.quit()43if __name__=="__main__":44 unittest.main()45# util.initGraph()46# gra.printGraph()47#48# gra.genAllShortPath()49# print gra.randomPath()50# print gra.getPath('Manger', 'Suggest')51#...
getPath_test.py
Source:getPath_test.py
1from getPath import Point2from getPath import getPath3def test_getPath():4 maze = [5 [True, True, True],6 [True, False, False],7 [True, False, True],8 [False, True, True],9 ]10 assert getPath(maze) is None11 maze = [12 [True, True, True],13 [True, False, False],14 [True, True, True],15 [False, True, True],16 ]17 path = getPath(maze)18 assert len(path) == 619 assert Point(0, 0) in path20 assert Point(1, 0) in path21 assert Point(2, 0) in path22 assert Point(2, 1) in path23 assert Point(2, 2) in path or Point(3, 1) in path...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!