Best Python code snippet using autotest_python
working_with_dir.py
Source: working_with_dir.py
1from utilities import (space, separated, start, end, sub, new_topic)2import os3from datetime import datetime4# Key5key = 'modules_os_dir_and_navigation'6def comeback():7 # goback to project working dir8 os.chdir('D:\\Programming\\Python\\Corey_Schafer_Tutorial')9def run():10 start('Modules and Packages')11 sub('Directory Management and Navigation')12 new_topic('dir() function')13 print(dir(os))14 new_topic('get current working dir with os.getcwd()', True)15 print(os.getcwd())16 new_topic('Navigate to new working directory os.chdir()', True)17 os.chdir('D:\\Programming\\Python')18 print(os.getcwd())19 # comeback to project working dir20 comeback()21 new_topic('List directory with os.listdir()', True)22 print(os.listdir())23 new_topic('Create a new directory with os.mkdir() and os.makedirs', True)24 # go to a temp foloder25 os.chdir('D:\\Temp\\Python')26 # os.mkdir will create the top level27 os.mkdir('dir1')28 # os.makedirs will be created both the top and its sub dirs immediately29 os.makedirs('dir2/sub_dir')30 print(f'current objs in the dir: {os.listdir()}')31 new_topic('Create a new directory with os.rmdir() and os.removedirs', True)32 # os.rmdir will delete only the top level33 os.rmdir('dir1')34 # os.removedirs will be deleted both the top and its sub dirs immediately35 os.removedirs('dir2/sub_dir')36 print(f'current objs in the dir: {os.listdir()}')37 # new_topic('Create a new file', True)38 new_topic('Rename a file with os.rename()', True)39 print(f'current objs in the dir: {os.listdir()}')40 # os.rename('test.txt', 'test_rename.txt')41 print(f'current objs in the dir: {os.listdir()}')42 new_topic('Check file stat with os.stat()', True)43 print(os.stat('test_rename.txt'))44 print(os.stat('test_rename.txt').st_size)45 print(f'modified at: {os.stat("test_rename.txt").st_mtime}')46 mod_time = os.stat('test_rename.txt').st_mtime47 print(f'modified at: {datetime.fromtimestamp(mod_time)}')48 new_topic('list all objects with os.walk()', True)49 current_dir = os.getcwd()50 # current path is the starting point51 for dirpath, dirnames, filenames in os.walk(current_dir):52 print('Current Path:', dirpath)53 print('Directories:', dirnames)54 print('Files', filenames)55 comeback()...
file_tests.py
Source: file_tests.py
...18 test_manual()19 test_dvk_html()20 test_sequencing()21 test_reformat()...
test_rename.py
Source: test_rename.py
1# Copyright 2012 Viewfinder Inc. All Rights Reserved.2"""Test object for the TEST_RENAME database testing table.3"""4__author__ = 'andy@emailscrubbed.com (Andy Kimball)'5from viewfinder.backend.db import vf_schema6from viewfinder.backend.db.base import DBObject7from viewfinder.backend.db.range_base import DBRangeObject8@DBObject.map_table_attributes9class TestRename(DBRangeObject):10 """Used for testing."""11 __slots__ = []...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
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!!