Best Python code snippet using localstack_python
common.py
Source:common.py
...126 def __key(self):127 return tuple((k,self[k]) for k in sorted(self))128 def __hash__(self):129 return 5130def test_hashable_dict():131 print('test_hashable_dict()')132 cls = HashableDict133 cls = BadHashableDict134 a = cls()135 a[0] = 0136 a[1] = 1137 b = cls()138 b[0] = 0139 b[1] = 1140 c = cls()141 c[0] = 0142 c[1] = 1143 144 d = {}145 146 d[a] = "a"147 148 print(d)149 print(d[a])150 print(d[b])151 152 a[0] = 666153 154 print(d[b])...
test_collections.py
Source:test_collections.py
...31 assert "z" not in d132 with pytest.raises(Exception) as exc:33 d1["foo"] = "bar"34 exc.match("does not support item assignment")35def test_hashable_dict():36 d1 = HashableJsonDict({"a": ["b"], "c": 1})37 d2 = HashableJsonDict({"a": "b"})38 d3 = HashableJsonDict({"c": 1, "a": ["b"]})39 d4 = HashableJsonDict({})40 assert len({d1, d2, d3}) == 241 assert {d1, d2, d3} == {d1, d2} == {d2, d3}42 assert {d1, d3} == {d3, d1}43 assert {d1, d1} == {d3, d3}44 assert {d1, d2, d3} != {d1}45 assert {d1, d2, d3} != {d2}46 assert {d1, d2, d3} != {d1, d3}47 assert {d4, d4} == {d4}48 with pytest.raises(Exception) as exc:49 d1["foo"] = "bar"...
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!!