Best Python code snippet using avocado_python
tests.py
Source:tests.py
...1213 def setUp(self):14 self.f = md51516 def test_empty_string(self):17 self.assertEqual(self.f('', string=True).hexdigest(),18 'd41d8cd98f00b204e9800998ecf8427e')1920 def test_less_than_one_block(self):21 self.assertEqual(self.f('abc', string=True).hexdigest(),22 '900150983cd24fb0d6963f7d28e17f72')2324 def test_exactly_one_block(self):25 self.assertEqual(self.f('x'*64, string=True).hexdigest(),26 'c1bb4f81d892b2d57947682aeb252456')2728 def test_many_blocks(self):29 self.assertEqual(self.f('x'*999999, string=True).hexdigest(),30 '38ebb7657e0b48f47a76fece544ebd3a')313233class TestSHA1(unittest.TestCase):34 def setUp(self):35 self.f = sha13637 def test_empty_string(self):38 self.assertEqual(self.f('', string=True).hexdigest(),39 'da39a3ee5e6b4b0d3255bfef95601890afd80709')4041 def test_less_than_one_block(self):42 self.assertEqual(self.f('abc', string=True).hexdigest(),43 'a9993e364706816aba3e25717850c26c9cd0d89d')4445 def test_exactly_one_block(self):46 self.assertEqual(self.f('x'*64, string=True).hexdigest(),47 'bb2fa3ee7afb9f54c6dfb5d021f14b1ffe40c163')4849 def test_many_blocks(self):50 self.assertEqual(self.f('x'*999999, string=True).hexdigest(),51 '832af88ead51622a76b777eec75641d49f6201f6')525354class TestSHA224(unittest.TestCase):55 def setUp(self):56 self.f = sha2245758 def test_empty_string(self):59 self.assertEqual(self.f('', string=True).hexdigest(),60 'd14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f')6162 def test_less_than_one_block(self):63 self.assertEqual(self.f('abc', string=True).hexdigest(),64 '23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7')6566 def test_exactly_one_block(self):67 self.assertEqual(self.f('x'*64, string=True).hexdigest(),68 '08c3050e95fe11eacb9dc7824bf6a92bcf2d59c21701321fba0e62c5')6970 def test_many_blocks(self):71 self.assertEqual(self.f('x'*999999, string=True).hexdigest(),72 'c0f74690b134929fe1a93faed6b117cee52f9ed14d0dac4423900c2b')737475class TestSHA256(unittest.TestCase):76 def setUp(self):77 self.f = sha2567879 def test_empty_string(self):80 self.assertEqual(self.f('', string=True).hexdigest(),81 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')8283 def test_less_than_one_block(self):84 self.assertEqual(self.f('abc', string=True).hexdigest(),85 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad')8687 def test_exactly_one_block(self):88 self.assertEqual(self.f('x'*64, string=True).hexdigest(),89 '7ce100971f64e7001e8fe5a51973ecdfe1ced42befe7ee8d5fd6219506b5393c')9091 def test_many_blocks(self):92 self.assertEqual(self.f('x'*999999, string=True).hexdigest(),93 '6516d38f2a2c8f5e8b58ac18bb02b85fe92ee261f099a248b14d21ba3b1159a1')9495class TestSHA384(unittest.TestCase):96 def setUp(self):97 self.f = sha3849899 def test_empty_string(self):100 self.assertEqual(self.f('', string=True).hexdigest(),101 '38b060a751ac96384cd9327eb1b1e36a21fdb71114be0743' +102 '4c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b')103104 def test_less_than_one_block(self):105 self.assertEqual(self.f('abc', string=True).hexdigest(),106 'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded163' +107 '1a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7')108109 def test_exactly_one_block(self):110 self.assertEqual(self.f('x'*128, string=True).hexdigest(),111 'e660584956c8b1df44c92acb7c8eccfe0dca5255627c9fb4' +112 '4637c15363b772e5709edcf35b07bf43531951ab2fd51130')113114 def test_many_blocks(self):115 self.assertEqual(self.f('x'*999999, string=True).hexdigest(),116 'ead21eb75474257dc50d71edb0fe48ade19c6629baa05f32' +117 'db2422aa73476669cb666d69c5ddfd4cdb524a42240c0bdf')118119class TestSHA512(unittest.TestCase):120 def setUp(self):121 self.f = sha512122123 def test_empty_string(self):124 self.assertEqual(self.f('', string=True).hexdigest(),125 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce' +126 '47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e')127128 def test_less_than_one_block(self):129 self.assertEqual(self.f('abc', string=True).hexdigest(),130 'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a' +131 '2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f')132133 def test_exactly_one_block(self):134 self.assertEqual(self.f('x'*128, string=True).hexdigest(),135 'e2e22f8422b54b06e35c3ea30a383d1de7a8fbc27992923074103117020d8dd7' +136 '024c3ecf7d6d1a15a6de5a75ff32fb486b9e8ced4c02ffe05822bf2cb734d0e0')137138 def test_many_blocks(self):139 self.assertEqual(self.f('x'*999999, string=True).hexdigest(),140 '024dc23fb03143e7db69a7b4500920bfdac2b25cdd49cd55a2654370314d84d9' +141 '6f485d25018ce94bb8c9465748a1b7b7e255e7d5e98456f804791ce922304ba1')142143class TestSHA512_224(unittest.TestCase):144 def setUp(self):145 self.f = sha512_t146147 def test_empty_string(self):148 self.assertEqual(self.f('', string=True, t=224).hexdigest(),149 '6ed0dd02806fa89e25de060c19d3ac86cabb87d6a0ddd05c333b84f4')150151 def test_less_than_one_block(self):152 self.assertEqual(self.f('abc', string=True, t=224).hexdigest(),153 '4634270f707b6a54daae7530460842e20e37ed265ceee9a43e8924aa')154155 def test_exactly_one_block(self):156 self.assertEqual(self.f('x'*128, string=True, t=224).hexdigest(),157 '89433771840172fc885ae35fc7f086fbcd0e74f98882046d6b05ff8d')158159 def test_many_blocks(self):160 self.assertEqual(self.f('x'*999999, string=True, t=224).hexdigest(),161 '6d266145701f6f6cb96e198670703d6cc060d3d783cf27df226e4d2b')162163164class TestSHA512_256(unittest.TestCase):165 def setUp(self):166 self.f = sha512_t167168 def test_empty_string(self):169 self.assertEqual(self.f('', string=True, t=256).hexdigest(),170 'c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a')171172 def test_less_than_one_block(self):173 self.assertEqual(self.f('abc', string=True, t=256).hexdigest(),174 '53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23')175176 def test_exactly_one_block(self):177 self.assertEqual(self.f('x'*128, string=True, t=256).hexdigest(),178 '6c0dfa95c650de7bb33dedd62fe0b0363f5deec77c582a216c7e33253f59a518')179180 def test_many_blocks(self):181 self.assertEqual(self.f('x'*999999, string=True, t=256).hexdigest(),182 '4edc0f8dcc3df6575c1d0d2fac27b8c4e2400bcb8033436c4207a1b70b581245')
...
roman_test.py
Source:roman_test.py
1import pytest2from roman import int_to_roman3def test_empty_string():4 """test_empty_string() should test input"""5 assert int_to_roman(0) == ''6def test_vaild_integer():7 """test_vaild_integer() should check an vaild integer input between 0 to 109"""8 with pytest.raises(ValueError):9 int_to_roman(number="Input a integer") 10def test_known_values():11 """test_empty_string() should test known roman values"""12 assert int_to_roman(1) == 'I'13 assert int_to_roman(4) == 'IV'14 assert int_to_roman(5) == 'V'15 assert int_to_roman(9) == 'IX'16 assert int_to_roman(10) == 'X'17 18def testing_single_double_triple_int_to_roman():19 """testing_single_double_triple_int_to_roman() should test single, double and triple roman values conversion"""20 assert int_to_roman (1) == 'I'21 assert int_to_roman (10) == 'X'...
test_app.py
Source:test_app.py
2"""Test function"""3from app import repeaded_char4import unittest5class TestStringMethods(unittest.TestCase):6 def test_empty_string(self):7 self.assertEqual(repeaded_char(""), ('', -1))8 def test_empty_string(self):9 self.assertEqual(repeaded_char("abcdefg"), ('', -1))10 def test_empty_string(self):11 self.assertEqual(repeaded_char("abcdefga"), ('a', 1))12 def test_empty_string(self):13 self.assertEqual(repeaded_char("abcdefgijklmnñopqrstuwxyz1234567890.,!#$%&/¡?"), ('', -1))14 15 def test_empty_string(self):...
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!!