Best Python code snippet using avocado_python
tf_test_spec.py
Source:tf_test_spec.py
...36def test_valid_decoded(specfile, datatype, encoded, decoded):37 test_encode(s=specfile, t=datatype, e=encoded, d=decoded)38 test_validate_decoded(s=specfile, t=datatype, d=decoded, v=True)39def test_invalid_encoded(specfile, datatype, encoded):40 test_decode_invalid(s=specfile, t=datatype, e=encoded)41 test_validate_encoded(s=specfile, t=datatype, e=encoded, v=False)42def test_invalid_decoded(specfile, datatype, decoded):43 test_encode_invalid(s=specfile, t=datatype, d=decoded)44 test_validate_decoded(s=specfile, t=datatype, d=decoded, v=False)45def get_as_list(d, key):46 result = d.get(key, [])47 return result if isinstance(result, list) else [result]48def test_all_invalid(specfile, datatype, tests):49 key = "invalid"50 if key in tests:51 if isinstance(tests[key], dict):52 for encoded in get_as_list(tests[key], "encoded"):53 test_invalid_encoded(specfile, datatype, encoded)54 for decoded in get_as_list(tests[key], "decoded"):...
test_bech32.py
Source:test_bech32.py
...29 for c,p in valid:30 c = c.lower()31 p = bytes.fromhex(p)[2:]32 assert bytes(decode(c[:2], c)[1]) == p33def test_decode_invalid():34 for c in invalid:35 c = c.lower()36 with pytest.raises(Exception):...
test_gdb.py
Source:test_gdb.py
...21 ('$foo#44', 'foo'))22 for io in in_out:23 i, o = io24 self.assertTrue(gdb.remote_decode(i), o)25 def test_decode_invalid(self):26 invalid_packets = ['$!#22',27 '$foo$bar#21',28 '!!#21',29 '+$!#21']30 for p in invalid_packets:31 self.assertRaises(gdb.InvalidPacketError,32 gdb.remote_decode, p)33if __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!!