Best Python code snippet using pyresttest_python
test_readfile.py
Source:test_readfile.py
...111 Remove dummy file112 '''113 readfile.ReadFile.CACHED = False114 remove_file(TEST_FILE)115 def test_cached_read(self):116 '''117 Test data does not change on cached read118 '''119 copyfile(TEST_FILE1, TEST_FILE)120 fhandle = readfile.ReadFile(root=DATA_DIR)121 fhandle.read()122 copyfile(TEST_FILE2, TEST_FILE)123 fhandle.read()124 self.assertEqual(125 fhandle.data,126 TEST_DATA1,127 msg='Incorrect data from cached file'128 )129class TestReadPidFile(BaseTestCase):...
tod.py
Source:tod.py
...60 np.testing.assert_equal(flags, self.flagvec)61 np.testing.assert_equal(common, self.pflagvec)62 np.testing.assert_almost_equal(data, self.datavec)63 return64 def test_cached_read(self):65 common = self.tod.local_common_flags()66 for d in self.dets:67 data = self.tod.local_signal(d)68 flags = self.tod.local_flags(d)69 np.testing.assert_equal(flags, self.flagvec)70 np.testing.assert_equal(common, self.pflagvec)71 np.testing.assert_almost_equal(data, self.datavec)72 # Then we can use the cached TOD73 common = self.tod.cache.reference("common_flags")74 for d in self.dets:75 data = self.tod.cache.reference("signal_" + d)76 flags = self.tod.cache.reference("flags_" + d)77 np.testing.assert_equal(flags, self.flagvec)78 np.testing.assert_equal(common, self.pflagvec)...
test_data.py
Source:test_data.py
...18 el = pyarbus.read_eyelink(gz_test_file)19 # cache this for viz tests which use this file, to save time20 pyarbus.data._cache[gz_test_file] = el21 return el22def test_cached_read():23 "Read a file (and cache it)"24 import time25 #del(pyarbus.data._cache[short_test_file])26 tic = time.time()27 el = pyarbus.read_eyelink_cached(short_test_file)28 toc = time.time()29 total_time = toc - tic30 # Here, we add a dummy attribute to the object - it should still be there31 # after we re-read short_test_file from cache, since we're not modifying32 # the object that's stored in the cache.33 el.__extra_dummy = 1034 tic = time.time()35 el = pyarbus.read_eyelink_cached(short_test_file)36 # windows time.time is only ms resolution:...
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!!