Best Python code snippet using lisa_python
test_figure_gen_utils.py
Source:test_figure_gen_utils.py
...22 ("ACG>ATG", "C>T", False),23])24def test_to_base_mut(input_mut, output_mut, cpg):25 assert to_base_mut(input_mut, cpg=cpg) == output_mut26def test_get_generation():27 assert get_generation("F48N5F75+10pF12") == -128 assert get_generation("F44+F14pF22") == 8029def test_revcomp():30 assert revcomp('ATTCAG') == 'CTGAAT'31 assert revcomp('T') == 'A'32 assert revcomp('CGA') == 'TCG'33def test_get_generation():34 assert get_generation("F48N5F75+10pF12") == -135 assert get_generation("F44+F14pF22") == 8036@pytest.mark.parametrize(37 'row,exp_output',38 [(pd.Series({39 'gen_at_seq': 56,40 'Year breeding started': 197641 }), 0.7321428),42 (pd.Series({43 'gen_at_seq': 12,44 'Year breeding started': 199945 }), 1.5)])46def test_calculate_years_per_gen(row, exp_output):47 assert np.allclose(calculate_years_per_gen(row), exp_output)48@pytest.mark.parametrize('row,exp_output', [49 (pd.Series({...
test_generate.py
Source:test_generate.py
...9 quizgen.config['TESTING'] = True10 with quizgen.test_client() as client:11 yield client12def test_valid_generation(client):13 rv = get_generation(client, 'Q312', 'Q18608993', '2', 'es')14 assert rv.status_code == 20015 assert len(rv.json) <= 216 rv = get_generation(client, 'Q312', 'Q18608993', '0', 'en')17 assert rv.status_code == 20018 assert len(rv.json) == 019def test_invalid_entity(client):20 rv = get_generation(client, '', 'Q18608993', '2', 'fr')21 assert rv.status_code == 20022 assert len(rv.json) == 023 rv = get_generation(client, 'Hola', 'Q18608993', '2', 'it')24 assert rv.status_code == 20025 assert len(rv.json) == 026def test_invalid_template(client):27 rv = get_generation(client, 'Q312', 'Hola', '2', 'pt')28 assert rv.status_code == 40429 rv = get_generation(client, 'Q312', '', '2', 'es')30 assert rv.status_code == 40431def test_invalid_limit(client):32 rv = get_generation(client, 'Q312', 'Q18608993', 'Hola', 'es')33 assert rv.status_code == 20034 rv = get_generation(client, 'Q312', 'Q18608993', '-1', 'es')35 assert rv.status_code == 20036def test_invalid_language(client):37 rv = get_generation(client, 'Q312', 'Q18608993', '2', '')38 assert rv.status_code == 20039 rv = get_generation(client, 'Q312', 'Q18608993', '0', 'ddaskq')40 assert rv.status_code == 20041def get_generation(client, entity, template, limit, language):42 rv = client.get(f'/generate/questions.json?entity={entity}&category={template}&limit={limit}&lang={language}')...
get_generation_test.py
Source:get_generation_test.py
...18 ]19 check = [[1,0,0],20 [0,1,1],21 [1,1,0]]22 self.assertEqual(get_generation(gliders[0], 0), gliders[0])23 self.assertEqual(get_generation(gliders[0], 1), gliders[1])24 self.assertEqual(gliders[0], check, 'The input array of cells was modified!')25 self.assertEqual(get_generation(gliders[0], 2), gliders[2]) 26 self.assertEqual(get_generation(gliders[0], 3), gliders[3])27 self.assertEqual(get_generation(gliders[0], 40), gliders[0])28 def test_complex(self):29 two_gliders = [[[1,1,1,0,0,0,1,0],30 [1,0,0,0,0,0,0,1],31 [0,1,0,0,0,1,1,1]],32 [[1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0],33 [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],34 [0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],35 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],36 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],37 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],38 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],39 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],40 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0],41 [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],42 [0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1]]43 ]44 self.assertEqual(get_generation(two_gliders[0], 16), two_gliders[1])45 46if __name__ == '__main__':...
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!!