Best Python code snippet using lisa_python
test_yumdb.py
Source:test_yumdb.py
...29 base = support.MockBase()30 pkgdb = self._instantiate(base)31 pkg = base.sack.query().installed().filter(name="pepper")[0]32 expected = '%s/yumdb/p/bad9-pepper-20-0-x86_64' % base.conf.persistdir33 directory = pkgdb._get_dir_name(pkg.pkgtup, b'bad9')34 self.assertEqual(expected, directory)35 directory = pkgdb._get_dir_name(pkg.pkgtup, 'bad9')36 self.assertEqual(expected, directory)37 directory = pkgdb._get_dir_name(pkg.pkgtup, None)38 self.assertEqual('%s/yumdb/p/<nopkgid>-pepper-20-0-x86_64' %...
generator.py
Source:generator.py
...4from app.utils.storage import StorageManagerFactory5class ConvertedDirNameMappingGenerator:6 def __init__(self, host_id):7 self.storage_manager = StorageManagerFactory.create(host_id=host_id)8 def _get_dir_name(self, condition):9 condition = condition.split('/', 1)[0].strip()10 if condition in EMERGENCY_CAR_CONDITION_DIR_NAME_MAPPING.keys():11 dir_name = EMERGENCY_CAR_CONDITION_DIR_NAME_MAPPING[condition]12 else:13 condition = condition.rsplit(' ', 1)[0]14 dir_name = CONDITION_DIR_NAME_MAPPING[condition]15 return dir_name16 def generate(self, input_csv_path):17 with self.storage_manager.open_file(input_csv_path, mode='r') as fd:18 df = pd.read_csv(fd)19 df['주ìì¡°ê±´'] = df.apply(lambda x: self._get_dir_name(x['주ìì¡°ê±´']), axis=1)20 df['ëë í 리'] = df.apply(lambda x: x['ëë í 리'].strip(), axis=1)21 converted_dir_name_mapping = df.set_index(['ëë í 리']).to_dict()...
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!!