Best Python code snippet using localstack_python
test_logger.py
Source:test_logger.py
...23 log = EventLogger(collector, "420")24 log.event("foo")25 assert log.session_id == "420"26 assert collector.next().metadata.session_id == "420"27def test_hash_strings():28 h = EventLogger.hash("foobar")29 assert h30 assert h != "foobar"31 assert EventLogger.hash("foobar") == h, "hash should be deterministic"32def test_hash_numbers():33 h = EventLogger.hash(12)34 assert h35 assert len(h) > 236 assert EventLogger.hash(12) == h, "hash should be deterministic"37def test_event_with_payload(collector):38 log = EventLogger(collector)39 log.event("foo", {"bar": "ed", "ans": 42})40 log.event("bar", {"foo": "zed", "ans": 420})41 e1 = collector.next()...
hash_test.py
Source:hash_test.py
...24 self.assertEqual(hash(obj), hash(obj))25 def test_hash_same_objects2(self):26 obj = Obj()27 self.assertEqual(hash(obj), hash(obj))28 def test_hash_strings(self):29 str_1 = 'name'30 str_2 = 'name'31 self.assertEqual(hash(str_1), hash(str_2))32 def test_class_with_hash(self):33 obj1 = HashObj()34 obj2 = HashObj()35 self.assertEqual(hash(obj1), hash(obj2))36 obj1.name = 'Teddy'37 obj2.name = 'Ted'38 self.assertNotEqual(hash(obj1), hash(obj2))39 obj2.name = 'Teddy'40 self.assertEqual(hash(obj1), hash(obj2))41if __name__ == '__main__':42 unittest.main()
test_hasher.py
Source:test_hasher.py
...7 assert (8 hasher.hexdigest()9 == "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"10 )11def test_hash_strings():12 hasher = Hasher()13 hasher.add_str("test")14 hasher.add_str("string")15 assert (16 hasher.hexdigest()17 == "3c8727e019a42b444667a587b6001251becadabbb36bfed8087a92c18882d111"18 )19def test_hash_file():20 expected = hashlib.sha256()21 with tempfile.NamedTemporaryFile("w") as f:22 expected.update(f.name.encode("utf-8"))23 expected.update(b"test")24 f.write("test")25 f.flush()...
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!!