How to use _same_file method in autotest

Best Python code snippet using autotest_python

imageutils.py

Source:imageutils.py Github

copy

Full Screen

...12##################################################################################################13Very useful image related utilities14##################################################################################################15"""16def _same_file(x):17 return x18class Image:19 def __init__(self, dtype=_np.uint8):20 self.dir = None21 self.file = None22 self.array = None23 self.mask = None24 self.ground_truth = None25 self.extras = {}26 self.dtype = dtype27 def load(self, dir, file):28 try:29 self.dir = dir30 self.file = file...

Full Screen

Full Screen

test_drive_par.py

Source:test_drive_par.py Github

copy

Full Screen

...3@pytest.fixture(scope="session")4def tempdir(tmpdir_factory):5 d = tmpdir_factory.mktemp("")6 return str(d)7def _same_file(file1, file2):8 lines1 = open(file1, "r").readlines()9 lines2 = open(file2, "r").readlines()10 return lines1 == lines211def test_drive_par(authenticated_user, tempdir):12 drive_name = "test å∫ç∂ pars"13 creds = StorageCreds(user=authenticated_user, service_url="storage")14 drive = Drive(name=drive_name, creds=creds)15 drive.upload(filename=__file__, uploaded_name="tmp_test.py")16 downloaded_name = drive.download(filename="tmp_test.py", dir=tempdir)17 assert(_same_file(__file__, downloaded_name))18 drive_guid = drive.metadata().guid()19 location = Location(drive_guid=drive_guid)20 par = PAR(location=location, user=authenticated_user,21 aclrule=ACLRule.reader())22 par_drive = par.resolve()23 assert(par_drive.metadata().acl() == ACLRule.reader())24 assert(par_drive.metadata().uid() == drive.metadata().uid())25 files = par_drive.list_files()26 assert(len(files) == 1)27 assert(files[0].filename() == "tmp_test.py")28 downloaded_name = files[0].open().download(dir=tempdir,29 force_par=True)30 assert(_same_file(__file__, downloaded_name))31 par2 = PAR(location=location, user=authenticated_user,32 aclrule=ACLRule.writer())33 par_drive = par2.resolve()34 assert(par_drive.metadata().acl() == ACLRule.writer())35 assert(par_drive.metadata().uid() == drive.metadata().uid())36 files = par_drive.list_files()37 assert(len(files) == 1)38 assert(files[0].filename() == "tmp_test.py")39 par_drive.upload(filename=__file__, uploaded_name="tmp_test2.py")40 files = par_drive.list_files()41 assert(len(files) == 2)42 f = {}43 f[files[0].filename()] = files[0]44 f[files[1].filename()] = files[1]45 files = f46 assert("tmp_test.py" in files)47 assert("tmp_test2.py" in files)48 downloaded_name = files["tmp_test2.py"].open().download(dir=tempdir)49 assert(_same_file(__file__, downloaded_name))50 par = PAR(location=files["tmp_test.py"].location(),51 user=authenticated_user,52 aclrule=ACLRule.reader())53 par_file = par.resolve()54 assert(par_file.metadata().acl() == ACLRule.reader())55 downloaded_name = par_file.download(dir=tempdir)56 assert(_same_file(__file__, downloaded_name))57 with pytest.raises(PermissionError):58 par_file.upload(__file__)59 par = PAR(location=files["tmp_test.py"].location(),60 user=authenticated_user,61 aclrule=ACLRule.writer())62 par_file = par.resolve()63 assert(par_file.metadata().acl() == ACLRule.writer())...

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 autotest 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