Best Python code snippet using pytest-benchmark
test_commands.py
Source:test_commands.py
...27 self.assertEqual(-1, client.exhset('key1', 'a', '3', xx=True))28 def test_exhset_px(self):29 self.assertEqual(1, client.exhset('key', 'a', 1, px=10000))30 self.assertEqual(b'1', client.exhget('key', 'a'))31 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)32 self.assertLessEqual(0, client.exhpttl('key', 'a'))33 self.assertLessEqual(client.exhttl('key', 'a'), 10)34 self.assertLessEqual(0, client.exhttl('key', 'a'))35 def test_exhset_px_timedelta(self):36 pexpire_timedelta = timedelta(milliseconds=10000)37 self.assertEqual(1, client.exhset('key', 'a', 1, px=pexpire_timedelta))38 self.assertEqual(b'1', client.exhget('key', 'a'))39 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)40 self.assertLessEqual(0, client.exhpttl('key', 'a'))41 self.assertLessEqual(client.exhttl('key', 'a'), 10)42 self.assertLessEqual(0, client.exhttl('key', 'a'))43 def test_exhset_ex(self):44 self.assertEqual(1, client.exhset('key', 'a', 1, ex=10))45 self.assertEqual(b'1', client.exhget('key', 'a'))46 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)47 self.assertLessEqual(0, client.exhpttl('key', 'a'))48 self.assertLessEqual(client.exhttl('key', 'a'), 10)49 self.assertLessEqual(0, client.exhttl('key', 'a'))50 def test_exhset_ex_timedelta(self):51 expire_timedelta = timedelta(seconds=10)52 self.assertEqual(1, client.exhset('key', 'a', 1, ex=expire_timedelta))53 self.assertEqual(b'1', client.exhget('key', 'a'))54 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)55 self.assertLessEqual(0, client.exhpttl('key', 'a'))56 self.assertLessEqual(client.exhttl('key', 'a'), 10)57 self.assertLessEqual(0, client.exhttl('key', 'a'))58 def test_exhset_pxat(self):59 pexpire_at = int(time() * 1000) + 1000060 self.assertEqual(1, client.exhset('key', 'a', 1, pxat=pexpire_at))61 self.assertEqual(b'1', client.exhget('key', 'a'))62 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)63 self.assertLessEqual(0, client.exhpttl('key', 'a'))64 self.assertLessEqual(client.exhttl('key', 'a'), 10)65 self.assertLessEqual(0, client.exhttl('key', 'a'))66 def test_exhset_pxat_timedelta(self):67 pexpire_at_timedelta = datetime.now() + timedelta(milliseconds=10000)68 self.assertEqual(1, client.exhset('key', 'a', 1, pxat=pexpire_at_timedelta))69 self.assertEqual(b'1', client.exhget('key', 'a'))70 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)71 self.assertLessEqual(0, client.exhpttl('key', 'a'))72 self.assertLessEqual(client.exhttl('key', 'a'), 10)73 self.assertLessEqual(0, client.exhttl('key', 'a'))74 def test_exhset_exat(self):75 expire_at = int(time()) + 1076 self.assertEqual(1, client.exhset('key', 'a', 1, exat=expire_at))77 self.assertEqual(b'1', client.exhget('key', 'a'))78 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)79 self.assertLessEqual(0, client.exhpttl('key', 'a'))80 self.assertLessEqual(client.exhttl('key', 'a'), 10)81 self.assertLessEqual(0, client.exhttl('key', 'a'))82 def test_exhset_exat_timedelta(self):83 expire_at_timedelta = datetime.now() + timedelta(seconds=10)84 self.assertEqual(1, client.exhset('key', 'a', 1, exat=expire_at_timedelta))85 self.assertEqual(b'1', client.exhget('key', 'a'))86 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)87 self.assertLessEqual(0, client.exhpttl('key', 'a'))88 self.assertLessEqual(client.exhttl('key', 'a'), 10)89 self.assertLessEqual(0, client.exhttl('key', 'a'))90 def test_exhset_ver(self):91 self.assertEqual(1, client.exhset('key', 'a', 1))92 self.assertEqual(b'1', client.exhget('key', 'a'))93 self.assertEqual(0, client.exhset('key', 'a', 2, ver=1))94 self.assertEqual(b'2', client.exhget('key', 'a'))95 self.assertEqual(2, client.exhver('key', 'a'))96 with self.assertRaisesRegex(redis.exceptions.ResponseError, "update version is stale"):97 client.exhset('key', 'a', 2, ver=1)98 with self.assertRaisesRegex(redis.exceptions.ResponseError, "update version is stale"):99 client.exhset('key', 'a', 2, ver=3)100 self.assertEqual(1, client.exhset('key', 'b', 2, ver=6))101 self.assertEqual(b'2', client.exhget('key', 'b'))102 self.assertEqual(1, client.exhver('key', 'b'))103 self.assertEqual(1, client.exhset('key1', 'b', 2, ver=6))104 self.assertEqual(b'2', client.exhget('key1', 'b'))105 self.assertEqual(1, client.exhver('key1', 'b'))106 def test_exhset_abs(self):107 self.assertEqual(1, client.exhset('key', 'a', 1))108 self.assertEqual(b'1', client.exhget('key', 'a'))109 self.assertEqual(1, client.exhver('key', 'a'))110 self.assertEqual(0, client.exhset('key', 'a', 2, abs=6))111 self.assertEqual(b'2', client.exhget('key', 'a'))112 self.assertEqual(6, client.exhver('key', 'a'))113 self.assertEqual(1, client.exhset('key1', 'b', 'b', abs=6))114 self.assertEqual(b'b', client.exhget('key1', 'b'))115 self.assertEqual(6, client.exhver('key1', 'b'))116 # def test_exhset_noactive(self):117 # pexpire_at_timedelta = datetime.now() + timedelta(milliseconds=100)118 # self.assertEqual(1, client.exhset('key', 'a', 1, pxat=pexpire_at_timedelta, noactive=True))119 # sleep(200)120 # self.assertEqual(1, client.exhlen('key', True))121 def test_exhmset_and_exhmget(self):122 self.assertEqual(b'OK', client.exhmset('key', mapping={'a': 1, 'b': 2, 'c': 3}))123 self.assertEqual(b'1', client.exhget('key', 'a'))124 self.assertEqual(b'2', client.exhget('key', 'b'))125 self.assertEqual(b'3', client.exhget('key', 'c'))126 self.assertEqual([b'1', b'2', b'3'], client.exhmget('key', ['a', 'b', 'c']))127 self.assertEqual([b'1', b'2', b'3'], client.exhmget('key', 'a', 'b', 'c'))128 def test_exhpexpireat(self):129 self.assertEqual(1, client.exhset('key', 'a', 1))130 self.assertEqual(-1, client.exhpttl('key', 'a'))131 exhpexpireat = int(time() * 1000) + 10000132 self.assertEqual(1, client.exhpexpireat('key', 'a', pxat=exhpexpireat))133 self.assertEqual(b'1', client.exhget('key', 'a'))134 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)135 self.assertLessEqual(0, client.exhpttl('key', 'a'))136 self.assertLessEqual(client.exhttl('key', 'a'), 10)137 self.assertLessEqual(0, client.exhttl('key', 'a'))138 def test_exhpexpireat_timedelta(self):139 self.assertEqual(1, client.exhset('key', 'a', 1))140 self.assertEqual(-1, client.exhpttl('key', 'a'))141 exhpexpireat_timedelta = datetime.now() + timedelta(microseconds=10000)142 self.assertEqual(1, client.exhpexpireat('key', 'a', pxat=exhpexpireat_timedelta))143 self.assertEqual(b'1', client.exhget('key', 'a'))144 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)145 self.assertLessEqual(0, client.exhpttl('key', 'a'))146 self.assertLessEqual(client.exhttl('key', 'a'), 10)147 self.assertLessEqual(0, client.exhttl('key', 'a'))148 def test_exhpexpireat_ver(self):149 self.assertEqual(1, client.exhset('key', 'a', 1))150 self.assertEqual(-1, client.exhpttl('key', 'a'))151 exhpexpireat = int(time() * 1000) + 10000152 self.assertEqual(1, client.exhpexpireat('key', 'a', pxat=exhpexpireat, ver=1))153 self.assertEqual(b'1', client.exhget('key', 'a'))154 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)155 self.assertLessEqual(0, client.exhpttl('key', 'a'))156 self.assertLessEqual(client.exhttl('key', 'a'), 10)157 self.assertLessEqual(0, client.exhttl('key', 'a'))158 with self.assertRaisesRegex(redis.exceptions.ResponseError, "update version is stale"):159 client.exhpexpireat('key', 'a', pxat=exhpexpireat, ver=2)160 self.assertEqual(0, client.exhpexpireat('key', 'b', pxat=exhpexpireat, ver=2))161 self.assertEqual(0, client.exhpexpireat('key1', 'b', pxat=exhpexpireat, ver=2))162 def test_exhpexpireat_abs(self):163 self.assertEqual(1, client.exhset('key', 'a', 1))164 self.assertEqual(-1, client.exhpttl('key', 'a'))165 exhpexpireat = int(time() * 1000) + 10000166 self.assertEqual(1, client.exhpexpireat('key', 'a', pxat=exhpexpireat, abs=6))167 self.assertEqual(6, client.exhver('key', 'a'))168 self.assertEqual(b'1', client.exhget('key', 'a'))169 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)170 self.assertLessEqual(0, client.exhpttl('key', 'a'))171 self.assertLessEqual(client.exhttl('key', 'a'), 10)172 self.assertLessEqual(0, client.exhttl('key', 'a'))173 self.assertEqual(0, client.exhpexpireat('key', 'b', pxat=exhpexpireat, abs=2))174 self.assertEqual(0, client.exhpexpireat('key1', 'b', pxat=exhpexpireat, abs=2))175 def test_exhexpireat(self):176 self.assertEqual(1, client.exhset('key', 'a', 1))177 self.assertEqual(-1, client.exhpttl('key', 'a'))178 exhexpireat = int(time()) + 10179 client.exhexpireat('key', 'a', exat=exhexpireat)180 self.assertEqual(b'1', client.exhget('key', 'a'))181 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)182 self.assertLessEqual(0, client.exhpttl('key', 'a'))183 self.assertLessEqual(client.exhttl('key', 'a'), 10)184 self.assertLessEqual(0, client.exhttl('key', 'a'))185 def test_exhexpireat_timedelta(self):186 self.assertEqual(1, client.exhset('key', 'a', 1))187 self.assertEqual(-1, client.exhpttl('key', 'a'))188 exhexpireat = datetime.now() + timedelta(seconds=10)189 client.exhexpireat('key', 'a', exat=exhexpireat)190 self.assertEqual(b'1', client.exhget('key', 'a'))191 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)192 self.assertLessEqual(0, client.exhpttl('key', 'a'))193 self.assertLessEqual(client.exhttl('key', 'a'), 10)194 self.assertLessEqual(0, client.exhttl('key', 'a'))195 def test_exhexpireat_ver(self):196 self.assertEqual(1, client.exhset('key', 'a', 1))197 self.assertEqual(-1, client.exhpttl('key', 'a'))198 exhexpireat = int(time()) + 10199 self.assertEqual(1, client.exhexpireat('key', 'a', exat=exhexpireat, ver=1))200 self.assertEqual(b'1', client.exhget('key', 'a'))201 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)202 self.assertLessEqual(0, client.exhpttl('key', 'a'))203 self.assertLessEqual(client.exhttl('key', 'a'), 10)204 self.assertLessEqual(0, client.exhttl('key', 'a'))205 with self.assertRaisesRegex(redis.exceptions.ResponseError, "update version is stale"):206 client.exhexpireat('key', 'a', exat=exhexpireat, ver=2)207 self.assertEqual(0, client.exhexpireat('key', 'b', exat=exhexpireat, ver=2))208 self.assertEqual(0, client.exhexpireat('key1', 'b', exat=exhexpireat, ver=2))209 def test_exhexpireat_abs(self):210 self.assertEqual(1, client.exhset('key', 'a', 1))211 self.assertEqual(-1, client.exhpttl('key', 'a'))212 exhexpireat = int(time()) + 10213 self.assertEqual(1, client.exhexpireat('key', 'a', exat=exhexpireat, abs=6))214 self.assertEqual(6, client.exhver('key', 'a'))215 self.assertEqual(b'1', client.exhget('key', 'a'))216 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)217 self.assertLessEqual(0, client.exhpttl('key', 'a'))218 self.assertLessEqual(client.exhttl('key', 'a'), 10)219 self.assertLessEqual(0, client.exhttl('key', 'a'))220 self.assertEqual(0, client.exhexpireat('key', 'b', exat=exhexpireat, abs=2))221 self.assertEqual(0, client.exhexpireat('key1', 'b', exat=exhexpireat, abs=2))222 def test_exhexpire(self):223 self.assertEqual(1, client.exhset('key', 'a', 1))224 self.assertEqual(-1, client.exhpttl('key', 'a'))225 self.assertEqual(1, client.exhexpire('key', 'a', ex=10))226 self.assertEqual(b'1', client.exhget('key', 'a'))227 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)228 self.assertLessEqual(0, client.exhpttl('key', 'a'))229 self.assertLessEqual(client.exhttl('key', 'a'), 10)230 self.assertLessEqual(0, client.exhttl('key', 'a'))231 def test_exhexpire_timedelta(self):232 self.assertEqual(1, client.exhset('key', 'a', 1))233 self.assertEqual(-1, client.exhpttl('key', 'a'))234 exhexpire = timedelta(seconds=10)235 self.assertEqual(1, client.exhexpire('key', 'a', ex=exhexpire))236 self.assertEqual(b'1', client.exhget('key', 'a'))237 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)238 self.assertLessEqual(0, client.exhpttl('key', 'a'))239 self.assertLessEqual(client.exhttl('key', 'a'), 10)240 self.assertLessEqual(0, client.exhttl('key', 'a'))241 def test_exhexpire_ver(self):242 self.assertEqual(1, client.exhset('key', 'a', 1))243 self.assertEqual(-1, client.exhpttl('key', 'a'))244 self.assertEqual(1, client.exhexpire('key', 'a', ex=10, ver=1))245 self.assertEqual(b'1', client.exhget('key', 'a'))246 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)247 self.assertLessEqual(0, client.exhpttl('key', 'a'))248 self.assertLessEqual(client.exhttl('key', 'a'), 10)249 self.assertLessEqual(0, client.exhttl('key', 'a'))250 try:251 self.assertEqual(1, client.exhexpire('key', 'a', ex=10, ver=2))252 except Exception as e:253 self.assertEqual("update version is stale", str(e))254 self.assertEqual(0, client.exhexpire('key', 'b', ex=10, ver=2))255 self.assertEqual(0, client.exhexpire('key1', 'b', ex=10, ver=2))256 def test_exhexpire_abs(self):257 self.assertEqual(1, client.exhset('key', 'a', 1))258 self.assertEqual(-1, client.exhpttl('key', 'a'))259 self.assertEqual(1, client.exhexpire('key', 'a', ex=10, abs=6))260 self.assertEqual(6, client.exhver('key', 'a'))261 self.assertEqual(b'1', client.exhget('key', 'a'))262 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)263 self.assertLessEqual(0, client.exhpttl('key', 'a'))264 self.assertLessEqual(client.exhttl('key', 'a'), 10)265 self.assertLessEqual(0, client.exhttl('key', 'a'))266 self.assertEqual(0, client.exhexpire('key', 'b', ex=10, abs=2))267 self.assertEqual(0, client.exhexpire('key1', 'b', ex=10, abs=2))268 def test_exhpexpire(self):269 self.assertEqual(1, client.exhset('key', 'a', 1))270 self.assertEqual(-1, client.exhpttl('key', 'a'))271 client.exhpexpire('key', 'a', px=10000)272 self.assertEqual(b'1', client.exhget('key', 'a'))273 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)274 self.assertLessEqual(0, client.exhpttl('key', 'a'))275 self.assertLessEqual(client.exhttl('key', 'a'), 10)276 self.assertLessEqual(0, client.exhttl('key', 'a'))277 def test_exhpexpire_timedelta(self):278 self.assertEqual(1, client.exhset('key', 'a', 1))279 self.assertEqual(-1, client.exhpttl('key', 'a'))280 exhpexpire = timedelta(milliseconds=10000)281 client.exhpexpire('key', 'a', px=exhpexpire)282 self.assertEqual(b'1', client.exhget('key', 'a'))283 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)284 self.assertLessEqual(0, client.exhpttl('key', 'a'))285 self.assertLessEqual(client.exhttl('key', 'a'), 10)286 self.assertLessEqual(0, client.exhttl('key', 'a'))287 def test_exhpexpire_ver(self):288 self.assertEqual(1, client.exhset('key', 'a', 1))289 self.assertEqual(-1, client.exhpttl('key', 'a'))290 self.assertEqual(1, client.exhpexpire('key', 'a', px=10000, ver=1))291 self.assertEqual(b'1', client.exhget('key', 'a'))292 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)293 self.assertLessEqual(0, client.exhpttl('key', 'a'))294 self.assertLessEqual(client.exhttl('key', 'a'), 10)295 self.assertLessEqual(0, client.exhttl('key', 'a'))296 try:297 self.assertEqual(1, client.exhpexpire('key', 'a', px=10000, ver=2))298 except Exception as e:299 self.assertEqual("update version is stale", str(e))300 self.assertEqual(0, client.exhpexpire('key', 'b', px=10000, ver=2))301 self.assertEqual(0, client.exhpexpire('key1', 'b', px=10000, ver=2))302 def test_exhpexpire_abs(self):303 self.assertEqual(1, client.exhset('key', 'a', 1))304 self.assertEqual(-1, client.exhpttl('key', 'a'))305 self.assertEqual(1, client.exhpexpire('key', 'a', px=10000, abs=6))306 self.assertEqual(6, client.exhver('key', 'a'))307 self.assertEqual(b'1', client.exhget('key', 'a'))308 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)309 self.assertLessEqual(0, client.exhpttl('key', 'a'))310 self.assertLessEqual(client.exhttl('key', 'a'), 10)311 self.assertLessEqual(0, client.exhttl('key', 'a'))312 self.assertEqual(0, client.exhpexpire('key', 'b', px=10000, abs=2))313 self.assertEqual(0, client.exhpexpire('key1', 'b', px=10000, abs=2))314 def test_exhsetver(self):315 self.assertEqual(1, client.exhset('key', 'a', '1'))316 self.assertEqual(1, client.exhsetver('key', 'a', 6))317 self.assertEqual(6, client.exhver('key', 'a'))318 self.assertEqual(0, client.exhsetver('key', 'b', 6))319 self.assertEqual(0, client.exhsetver('key1', 'b', 6))320 def test_exhgetwithver(self):321 self.assertEqual(1, client.exhset('key', 'a', '1'))322 self.assertEqual([b'1', 1], client.exhgetwithver('key', 'a'))323 self.assertEqual(1, client.exhsetver('key', 'a', 6))324 self.assertEqual([b'1', 6], client.exhgetwithver('key', 'a'))325 def test_exhmgetwithver(self):326 self.assertEqual(b'OK', client.exhmset('key', mapping={'a': 1, 'b': 2, 'c': 3}))327 self.assertEqual([[b'1', 1], [b'2', 1], [b'3', 1]], client.exhmgetwithver('key', 'a', 'b', 'c'))328 def test_exhdel(self):329 self.assertEqual(b'OK', client.exhmset('key', mapping={'a': 1, 'b': 2, 'c': 3}))330 self.assertEqual(2, client.exhdel('key', 'a', 'b'))331 self.assertEqual(0, client.exhdel('key', 'a', 'b'))332 self.assertEqual(0, client.exhdel('key1', 'a', 'b'))333 def test_exhlen(self):334 self.assertEqual(b'OK', client.exhmset('key', mapping={'a': 1, 'b': 2, 'c': 3}))335 self.assertEqual(3, client.exhlen('key'))336 self.assertEqual(2, client.exhdel('key', 'a', 'b'))337 self.assertEqual(1, client.exhlen('key'))338 def test_exhexists(self):339 self.assertEqual(b'OK', client.exhmset('key', mapping={'a': 1, 'b': 2, 'c': 3}))340 self.assertEqual(1, client.exhexists('key', 'a'))341 self.assertEqual(0, client.exhexists('key', 'd'))342 self.assertEqual(0, client.exhexists('key1', 'a'))343 def test_exhstrlen(self):344 self.assertEqual(b'OK', client.exhmset('key', mapping={'a': 1, 'b': 22, 'c': 333}))345 self.assertEqual(1, client.exhstrlen('key', 'a'))346 self.assertEqual(2, client.exhstrlen('key', 'b'))347 self.assertEqual(3, client.exhstrlen('key', 'c'))348 self.assertEqual(0, client.exhstrlen('key', 'd'))349 self.assertEqual(0, client.exhstrlen('key1', 'a'))350 def test_exhkeys(self):351 self.assertEqual([], client.exhkeys('key'))352 self.assertEqual(b'OK', client.exhmset('key', mapping={'a': 1, 'b': 2, 'c': 3}))353 self.assertEqual([b'c', b'b', b'a'], client.exhkeys('key'))354 def test_exhvals(self):355 self.assertEqual([], client.exhvals('key'))356 self.assertEqual(b'OK', client.exhmset('key', mapping={'a': 1, 'b': 2, 'c': 3}))357 self.assertEqual([b'3', b'2', b'1'], client.exhvals('key'))358 def test_exhgetall(self):359 self.assertEqual([], client.exhgetall('key'))360 self.assertEqual(b'OK', client.exhmset('key', mapping={'a': 1, 'b': 2, 'c': 3}))361 self.assertEqual([b'c', b'3', b'b', b'2', b'a', b'1'], client.exhgetall('key'))362 "----------------------------------"363 def test_exhincrby(self):364 self.assertEqual(1, client.exhset('key', 'a', 1))365 self.assertEqual(b'1', client.exhget('key', 'a'))366 self.assertEqual(2, client.exhincrby('key', 'a', 1))367 self.assertEqual(3, client.exhincrby('key', 'a', 1))368 self.assertEqual(1, client.exhincrby('key1', 'a', 1))369 self.assertEqual(1, client.exhincrby('key', 'b', 1))370 self.assertEqual(1, client.exhset('key', 'k', 'v'))371 with self.assertRaisesRegex(redis.exceptions.ResponseError, "value is not an integer"):372 client.exhincrby('key', 'k', 1)373 def test_exhincrby_ex(self):374 self.assertEqual(1, client.exhset('key', 'a', 1))375 self.assertEqual(-1, client.exhpttl('key', 'a'))376 self.assertEqual(2, client.exhincrby('key', 'a', 1, ex=10))377 self.assertEqual(b'2', client.exhget('key', 'a'))378 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)379 self.assertLessEqual(0, client.exhpttl('key', 'a'))380 self.assertLessEqual(client.exhttl('key', 'a'), 10)381 self.assertLessEqual(0, client.exhttl('key', 'a'))382 def test_exhincrby_ex_timedelta(self):383 self.assertEqual(1, client.exhset('key', 'a', 1))384 self.assertEqual(-1, client.exhpttl('key', 'a'))385 ex = timedelta(seconds=10)386 self.assertEqual(2, client.exhincrby('key', 'a', 1, ex=ex))387 self.assertEqual(b'2', client.exhget('key', 'a'))388 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)389 self.assertLessEqual(0, client.exhpttl('key', 'a'))390 self.assertLessEqual(client.exhttl('key', 'a'), 10)391 self.assertLessEqual(0, client.exhttl('key', 'a'))392 def test_exhincrby_px(self):393 self.assertEqual(1, client.exhset('key', 'a', 1))394 self.assertEqual(-1, client.exhpttl('key', 'a'))395 self.assertEqual(2, client.exhincrby('key', 'a', 1, px=10000))396 self.assertEqual(b'2', client.exhget('key', 'a'))397 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)398 self.assertLessEqual(0, client.exhpttl('key', 'a'))399 self.assertLessEqual(client.exhttl('key', 'a'), 10)400 self.assertLessEqual(0, client.exhttl('key', 'a'))401 def test_exhincrby_px_timedelta(self):402 self.assertEqual(1, client.exhset('key', 'a', 1))403 self.assertEqual(-1, client.exhpttl('key', 'a'))404 px = timedelta(seconds=10)405 self.assertEqual(2, client.exhincrby('key', 'a', 1, px=px))406 self.assertEqual(b'2', client.exhget('key', 'a'))407 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)408 self.assertLessEqual(0, client.exhpttl('key', 'a'))409 self.assertLessEqual(client.exhttl('key', 'a'), 10)410 self.assertLessEqual(0, client.exhttl('key', 'a'))411 def test_exhincrby_exat(self):412 self.assertEqual(1, client.exhset('key', 'a', 1))413 self.assertEqual(-1, client.exhpttl('key', 'a'))414 exat = int(time()) + 10415 self.assertEqual(2, client.exhincrby('key', 'a', 1, exat=exat))416 self.assertEqual(b'2', client.exhget('key', 'a'))417 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)418 self.assertLessEqual(0, client.exhpttl('key', 'a'))419 self.assertLessEqual(client.exhttl('key', 'a'), 10)420 self.assertLessEqual(0, client.exhttl('key', 'a'))421 def test_exhincrby_exat_timedelta(self):422 self.assertEqual(1, client.exhset('key', 'a', 1))423 self.assertEqual(-1, client.exhpttl('key', 'a'))424 exat = timedelta(seconds=10) + datetime.now()425 self.assertEqual(2, client.exhincrby('key', 'a', 1, exat=exat))426 self.assertEqual(b'2', client.exhget('key', 'a'))427 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)428 self.assertLessEqual(0, client.exhpttl('key', 'a'))429 self.assertLessEqual(client.exhttl('key', 'a'), 10)430 self.assertLessEqual(0, client.exhttl('key', 'a'))431 def test_exhincrby_pxat(self):432 self.assertEqual(1, client.exhset('key', 'a', 1))433 self.assertEqual(-1, client.exhpttl('key', 'a'))434 pxat = int(time()) * 1000 + 10000435 self.assertEqual(2, client.exhincrby('key', 'a', 1, pxat=pxat))436 self.assertEqual(b'2', client.exhget('key', 'a'))437 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)438 self.assertLessEqual(0, client.exhpttl('key', 'a'))439 self.assertLessEqual(client.exhttl('key', 'a'), 10)440 self.assertLessEqual(0, client.exhttl('key', 'a'))441 def test_exhincrby_pxat_timedelta(self):442 self.assertEqual(1, client.exhset('key', 'a', 1))443 self.assertEqual(-1, client.exhpttl('key', 'a'))444 pxat = timedelta(milliseconds=10000) + datetime.now()445 self.assertEqual(2, client.exhincrby('key', 'a', 1, pxat=pxat))446 self.assertEqual(b'2', client.exhget('key', 'a'))447 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)448 self.assertLessEqual(0, client.exhpttl('key', 'a'))449 self.assertLessEqual(client.exhttl('key', 'a'), 10)450 self.assertLessEqual(0, client.exhttl('key', 'a'))451 "------------"452 def test_exhincrby_ver(self):453 self.assertEqual(1, client.exhset('key', 'a', 1))454 self.assertEqual(b'1', client.exhget('key', 'a'))455 self.assertEqual(3, client.exhincrby('key', 'a', 2, ver=1))456 self.assertEqual(b'3', client.exhget('key', 'a'))457 self.assertEqual(2, client.exhver('key', 'a'))458 with self.assertRaisesRegex(redis.exceptions.ResponseError, "update version is stale"):459 client.exhincrby('key', 'a', 2, ver=1)460 with self.assertRaisesRegex(redis.exceptions.ResponseError, "update version is stale"):461 client.exhincrby('key', 'a', 2, ver=3)462 self.assertEqual(2, client.exhincrby('key', 'b', 2, ver=6))463 self.assertEqual(b'2', client.exhget('key', 'b'))464 self.assertEqual(1, client.exhver('key', 'b'))465 self.assertEqual(2, client.exhincrby('key1', 'b', 2, ver=6))466 self.assertEqual(b'2', client.exhget('key1', 'b'))467 self.assertEqual(1, client.exhver('key1', 'b'))468 def test_exhincrby_abs(self):469 self.assertEqual(1, client.exhset('key', 'a', 1))470 self.assertEqual(b'1', client.exhget('key', 'a'))471 self.assertEqual(1, client.exhver('key', 'a'))472 self.assertEqual(3, client.exhincrby('key', 'a', 2, abs=6))473 self.assertEqual(b'3', client.exhget('key', 'a'))474 self.assertEqual(6, client.exhver('key', 'a'))475 self.assertEqual(1, client.exhincrby('key1', 'b', 1, abs=6))476 self.assertEqual(b'1', client.exhget('key1', 'b'))477 self.assertEqual(6, client.exhver('key1', 'b'))478 def test_exhincrby_minval(self):479 self.assertEqual(1, client.exhset('key', 'a', 1))480 self.assertEqual(b'1', client.exhget('key', 'a'))481 self.assertEqual(3, client.exhincrby('key', 'a', 2, minval=3))482 self.assertEqual(5, client.exhincrby('key', 'a', 2, minval=3))483 with self.assertRaisesRegex(redis.exceptions.ResponseError, "increment or decrement would overflow"):484 client.exhincrby('key', 'a', 2, minval=10)485 def test_exhincrby_maxval(self):486 self.assertEqual(1, client.exhset('key', 'a', 1))487 self.assertEqual(b'1', client.exhget('key', 'a'))488 self.assertEqual(3, client.exhincrby('key', 'a', 2, maxval=10))489 self.assertEqual(5, client.exhincrby('key', 'a', 2, maxval=10))490 self.assertEqual(7, client.exhincrby('key', 'a', 2, maxval=10))491 self.assertEqual(9, client.exhincrby('key', 'a', 2, maxval=10))492 with self.assertRaisesRegex(redis.exceptions.ResponseError, "increment or decrement would overflow"):493 client.exhincrby('key', 'a', 2, maxval=10)494 def test_exhincrbyfloat(self):495 self.assertEqual(1, client.exhset('key', 'a', 1))496 self.assertEqual(b'1', client.exhget('key', 'a'))497 self.assertAlmostEqual(2.0, float(client.exhincrbyfloat('key', 'a', 1.0)))498 self.assertAlmostEqual(3.0, float(client.exhincrbyfloat('key', 'a', 1.0)))499 self.assertAlmostEqual(1.0, float(client.exhincrbyfloat('key1', 'a', 1.0)))500 self.assertAlmostEqual(1.0, float(client.exhincrbyfloat('key', 'b', 1.0)))501 self.assertEqual(1, client.exhset('key', 'k', 'v'))502 with self.assertRaisesRegex(redis.exceptions.ResponseError, "value is not an float"):503 client.exhincrbyfloat('key', 'k', 1)504 def test_exhincrbyfloat_ex(self):505 self.assertEqual(1, client.exhset('key', 'a', 1))506 self.assertEqual(-1, client.exhpttl('key', 'a'))507 self.assertAlmostEqual(3.0, float(client.exhincrbyfloat('key', 'a', 2.0, ex=10)))508 self.assertAlmostEqual(3.0, float(client.exhget('key', 'a')))509 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)510 self.assertLessEqual(0, client.exhpttl('key', 'a'))511 self.assertLessEqual(client.exhttl('key', 'a'), 10)512 self.assertLessEqual(0, client.exhttl('key', 'a'))513 def test_exhincrbyfloat_ex_timedelta(self):514 self.assertEqual(1, client.exhset('key', 'a', 1))515 self.assertEqual(-1, client.exhpttl('key', 'a'))516 ex = timedelta(seconds=10)517 self.assertAlmostEqual(3.0, float(client.exhincrbyfloat('key', 'a', 2.0, ex=ex)))518 self.assertAlmostEqual(3.0, float(client.exhget('key', 'a')))519 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)520 self.assertLessEqual(0, client.exhpttl('key', 'a'))521 self.assertLessEqual(client.exhttl('key', 'a'), 10)522 self.assertLessEqual(0, client.exhttl('key', 'a'))523 def test_exhincrbyfloat_px(self):524 self.assertEqual(1, client.exhset('key', 'a', 1))525 self.assertEqual(-1, client.exhpttl('key', 'a'))526 self.assertAlmostEqual(3.0, float(client.exhincrbyfloat('key', 'a', 2.0, px=10000)))527 self.assertAlmostEqual(3.0, float(client.exhget('key', 'a')))528 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)529 self.assertLessEqual(0, client.exhpttl('key', 'a'))530 self.assertLessEqual(client.exhttl('key', 'a'), 10)531 self.assertLessEqual(0, client.exhttl('key', 'a'))532 def test_exhincrbyfloat_px_timedelta(self):533 self.assertEqual(1, client.exhset('key', 'a', 1))534 self.assertEqual(-1, client.exhpttl('key', 'a'))535 px = timedelta(seconds=10)536 self.assertAlmostEqual(3.0, float(client.exhincrbyfloat('key', 'a', 2.0, px=px)))537 self.assertAlmostEqual(3.0, float(client.exhget('key', 'a')))538 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)539 self.assertLessEqual(0, client.exhpttl('key', 'a'))540 self.assertLessEqual(client.exhttl('key', 'a'), 10)541 self.assertLessEqual(0, client.exhttl('key', 'a'))542 def test_exhincrbyfloat_exat(self):543 self.assertEqual(1, client.exhset('key', 'a', 1))544 self.assertEqual(-1, client.exhpttl('key', 'a'))545 exat = int(time()) + 10546 self.assertAlmostEqual(3.0, float(client.exhincrbyfloat('key', 'a', 2.0, exat=exat)))547 self.assertAlmostEqual(3.0, float(client.exhget('key', 'a')))548 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)549 self.assertLessEqual(0, client.exhpttl('key', 'a'))550 self.assertLessEqual(client.exhttl('key', 'a'), 10)551 self.assertLessEqual(0, client.exhttl('key', 'a'))552 def test_exhincrbyfloat_exat_timedelta(self):553 self.assertEqual(1, client.exhset('key', 'a', 1))554 self.assertEqual(-1, client.exhpttl('key', 'a'))555 exat = timedelta(seconds=10) + datetime.now()556 self.assertAlmostEqual(3.0, float(client.exhincrbyfloat('key', 'a', 2.0, exat=exat)))557 self.assertAlmostEqual(3.0, float(client.exhget('key', 'a')))558 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)559 self.assertLessEqual(0, client.exhpttl('key', 'a'))560 self.assertLessEqual(client.exhttl('key', 'a'), 10)561 self.assertLessEqual(0, client.exhttl('key', 'a'))562 def test_exhincrbyfloat_pxat(self):563 self.assertEqual(1, client.exhset('key', 'a', 1))564 self.assertEqual(-1, client.exhpttl('key', 'a'))565 pxat = int(time()) * 1000 + 10000566 self.assertAlmostEqual(3.0, float(client.exhincrbyfloat('key', 'a', 2.0, pxat=pxat)))567 self.assertAlmostEqual(3.0, float(client.exhget('key', 'a')))568 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)569 self.assertLessEqual(0, client.exhpttl('key', 'a'))570 self.assertLessEqual(client.exhttl('key', 'a'), 10)571 self.assertLessEqual(0, client.exhttl('key', 'a'))572 def test_exhincrbyfloat_pxat_timedelta(self):573 self.assertEqual(1, client.exhset('key', 'a', 1))574 self.assertEqual(-1, client.exhpttl('key', 'a'))575 pxat = timedelta(seconds=10) + datetime.now()576 self.assertAlmostEqual(3.0, float(client.exhincrbyfloat('key', 'a', 2.0, pxat=pxat)))577 self.assertAlmostEqual(3.0, float(client.exhget('key', 'a')))578 self.assertLessEqual(client.exhpttl('key', 'a'), 10000)579 self.assertLessEqual(0, client.exhpttl('key', 'a'))580 self.assertLessEqual(client.exhttl('key', 'a'), 10)581 self.assertLessEqual(0, client.exhttl('key', 'a'))582 def test_exhincrbyfloat_ver(self):583 self.assertEqual(1, client.exhset('key', 'a', 1))584 self.assertEqual(b'1', client.exhget('key', 'a'))585 self.assertAlmostEqual(3.0, float(client.exhincrbyfloat('key', 'a', 2.0, ver=1)))586 self.assertAlmostEqual(3.0, float(client.exhget('key', 'a')))587 self.assertEqual(2, client.exhver('key', 'a'))588 with self.assertRaisesRegex(redis.exceptions.ResponseError, "update version is stale"):589 client.exhincrbyfloat('key', 'a', 2, ver=1)590 with self.assertRaisesRegex(redis.exceptions.ResponseError, "update version is stale"):591 client.exhincrbyfloat('key', 'a', 2, ver=3)592 self.assertAlmostEqual(2.1, float(client.exhincrbyfloat('key', 'b', 2.1, ver=6)))593 self.assertAlmostEqual(2.1, float(client.exhget('key', 'b')))594 self.assertEqual(1, client.exhver('key', 'b'))595 self.assertAlmostEqual(2.9, float(client.exhincrbyfloat('key1', 'b', 2.9, ver=6)))...
test_unit_conversion.py
Source:test_unit_conversion.py
...25 self.assertTrue(self.adapter.can_process(statement))26 expected_value = 78740.227 response_statement = self.adapter.process(statement)28 self.assertIsNotNone(response_statement)29 self.assertLessEqual(abs(response_statement.confidence - 1.0), 1e-10)30 self.assertLessEqual(abs(float(response_statement.text) - expected_value), 0.1)31 def test_inches_to_kilometers_variation_1(self):32 statement = Statement(text='How many inches in two kilometers?')33 self.assertTrue(self.adapter.can_process(statement))34 expected_value = 78740.235 response_statement = self.adapter.process(statement)36 self.assertIsNotNone(response_statement)37 self.assertLessEqual(abs(response_statement.confidence - 1.0), 1e-10)38 self.assertLessEqual(abs(float(response_statement.text) - expected_value), 0.1)39 def test_inches_to_kilometers_variation_2(self):40 statement = Statement(text='how many inches in two kilometers ?')41 self.assertTrue(self.adapter.can_process(statement))42 expected_value = 78740.243 response_statement = self.adapter.process(statement)44 self.assertIsNotNone(response_statement)45 self.assertLessEqual(abs(response_statement.confidence - 1.0), 1e-10)46 self.assertLessEqual(abs(float(response_statement.text) - expected_value), 0.1)47 def test_inches_to_kilometers_variation_3(self):48 statement = Statement(text='how many inches in 2 kilometers ?')49 self.assertTrue(self.adapter.can_process(statement))50 expected_value = 78740.251 response_statement = self.adapter.process(statement)52 self.assertIsNotNone(response_statement)53 self.assertLessEqual(abs(response_statement.confidence - 1.0), 1e-10)54 self.assertLessEqual(abs(float(response_statement.text) - expected_value), 0.1)55 def test_meter_to_kilometer(self):56 statement = Statement(text='How many meters are in one kilometer?')57 self.assertTrue(self.adapter.can_process(statement))58 expected_value = 100059 response_statement = self.adapter.process(statement)60 self.assertIsNotNone(response_statement)61 self.assertLessEqual(abs(response_statement.confidence - 1.0), 0.1)62 self.assertLessEqual(abs(float(response_statement.text) - expected_value), 0.1)63 def test_meter_to_kilometer_variation(self):64 statement = Statement(text='How many meters are in a kilometer?')65 self.assertTrue(self.adapter.can_process(statement))66 expected_value = 100067 response_statement = self.adapter.process(statement)68 self.assertIsNotNone(response_statement)69 self.assertLessEqual(abs(response_statement.confidence - 1.0), 0.1)70 self.assertLessEqual(abs(float(response_statement.text) - expected_value), 0.1)71 def test_temperature_celsius_to_fahrenheit(self):72 statement = Statement(text='How many fahrenheit are in 0 celsius ?')73 self.assertTrue(self.adapter.can_process(statement))74 expected_value = 3275 response_statement = self.adapter.process(statement)76 self.assertIsNotNone(response_statement)77 self.assertLessEqual(abs(response_statement.confidence - 1.0), 0.1)78 self.assertLessEqual(abs(float(response_statement.text) - expected_value), 0.1)79 def test_negative_temperature_celsius_to_fahrenheit(self):80 statement = Statement(text='How many fahrenheit are in -0.2 celsius ?')81 self.assertTrue(self.adapter.can_process(statement))82 expected_value = 31.6483 response_statement = self.adapter.process(statement)84 self.assertIsNotNone(response_statement)85 self.assertLessEqual(abs(response_statement.confidence - 1.0), 0.1)86 self.assertLessEqual(abs(float(response_statement.text) - expected_value), 0.1)87 def test_time_two_hours_to_seconds(self):88 statement = Statement(text='How many seconds are in two hours?')89 self.assertTrue(self.adapter.can_process(statement))90 expected_value = 720091 response_statement = self.adapter.process(statement)92 self.assertIsNotNone(response_statement)93 self.assertLessEqual(abs(response_statement.confidence - 1.0), 0.1)94 self.assertLessEqual(abs(float(response_statement.text) - expected_value), 0.1)95 def test_pattern_x_unit_to_y_unit(self):96 statement = Statement(text='-11 Celsius to kelvin')97 self.assertTrue(self.adapter.can_process(statement))98 expected_value = 262.1599 response_statement = self.adapter.process(statement)100 self.assertIsNotNone(response_statement)101 self.assertLessEqual(abs(response_statement.confidence - 1.0), 0.1)102 self.assertLessEqual(abs(float(response_statement.text) - expected_value), 0.1)103 def test_pattern_x_unit_is_how_many_y_unit(self):104 statement = Statement(text='2 TB is how many GB?')105 self.assertTrue(self.adapter.can_process(statement))106 expected_value = 2000107 response_statement = self.adapter.process(statement)108 self.assertIsNotNone(response_statement)109 self.assertLessEqual(abs(response_statement.confidence - 1.0), 0.1)...
test.py
Source:test.py
...24 s = similarity.Similarity(self.path1,path2).similar()25 print('%.2f' % s)26 # 对æ¯å¤ææµè¯æ¯å¦æ£ç¡®27 self.assertGreaterEqual(s, 0)28 self.assertLessEqual(s, 1)2930 def test_add(self):31 print("\ntest add")32 path2 = "./orig_0.8_add.txt"33 s = similarity.Similarity(self.path1, path2).similar()34 print('%.2f' % s)35 # 对æ¯å¤ææµè¯æ¯å¦æ£ç¡®36 self.assertGreaterEqual(s, 0)37 self.assertLessEqual(s, 1)38 def test_del(self):39 print("\ntest del")40 path2 = "./orig_0.8_del.txt"41 s = similarity.Similarity(self.path1, path2).similar()42 print('%.2f' % s)43 # 对æ¯å¤ææµè¯æ¯å¦æ£ç¡®44 self.assertGreaterEqual(s, 0)45 self.assertLessEqual(s, 1)46 def test_dis_1(self):47 print("\ntest dis_1")48 path2 = "./orig_0.8_dis_1.txt"49 s = similarity.Similarity(self.path1, path2).similar()50 print('%.2f' % s)51 # 对æ¯å¤ææµè¯æ¯å¦æ£ç¡®52 self.assertGreaterEqual(s, 0)53 self.assertLessEqual(s, 1)54 def test_dis_3(self):55 print("\ntest dis_3")56 path2 = "./orig_0.8_dis_3.txt"57 s = similarity.Similarity(self.path1, path2).similar()58 print('%.2f' % s)59 # 对æ¯å¤ææµè¯æ¯å¦æ£ç¡®60 self.assertGreaterEqual(s, 0)61 self.assertLessEqual(s, 1)62 def test_dis_7(self):63 print("\ntest dis_7")64 path2 = "./orig_0.8_dis_7.txt"65 s = similarity.Similarity(self.path1, path2).similar()66 print('%.2f' % s)67 # 对æ¯å¤ææµè¯æ¯å¦æ£ç¡®68 self.assertGreaterEqual(s, 0)69 self.assertLessEqual(s, 1)70 def test_dis_10(self):71 print("\ntest dis_10")72 path2 = "./orig_0.8_dis_10.txt"73 s = similarity.Similarity(self.path1, path2).similar()74 print('%.2f' % s)75 # 对æ¯å¤ææµè¯æ¯å¦æ£ç¡®76 self.assertGreaterEqual(s, 0)77 self.assertLessEqual(s, 1)78 def test_dis_15(self):79 print("\ntest dis_15")80 path2 = "./orig_0.8_dis_15.txt"81 s = similarity.Similarity(self.path1, path2).similar()82 print('%.2f' % s)83 # 对æ¯å¤ææµè¯æ¯å¦æ£ç¡®84 self.assertGreaterEqual(s, 0)85 self.assertLessEqual(s, 1)86 def test_mix(self):87 print("\ntest mix")88 path2 = "./orig_0.8_mix.txt"89 s = similarity.Similarity(self.path1, path2).similar()90 print('%.2f' % s)91 # 对æ¯å¤ææµè¯æ¯å¦æ£ç¡®92 self.assertGreaterEqual(s, 0)93 self.assertLessEqual(s, 1)94 def test_rep(self):95 print("\ntest rep")96 path2 = "./orig_0.8_rep.txt"97 s = similarity.Similarity(self.path1, path2).similar()98 print('%.2f' % s)99 # 对æ¯å¤ææµè¯æ¯å¦æ£ç¡®100 self.assertGreaterEqual(s, 0)101 self.assertLessEqual(s, 1)102103 def test_null(self):104 print("\n空ææ¬æµè¯ï¼")105 path2 = "./null.txt"106 similarity.Similarity(self.path1, path2)107 self.assertRaises(similarity.emptyError)108 def test_pathError(self):109 print("\nè·¯å¾æµè¯ï¼")110 path2 = "./error_path.txt"111 self.assertRaises(similarity.pathError,similarity.Similarity,self.path1,path2)112113if __name__ == '__main__':
...
test_enums.py
Source:test_enums.py
...32 self.assertLess(Stage.NEW, "inserted")33 self.assertLess(Stage.ARCHIVED, "staged")34 self.assertLess(Stage.NEW, "completed")35 def test_less_than_or_equal(self):36 self.assertLessEqual(Stage.INSERTED, Stage.COMPLETED)37 self.assertLessEqual(Stage.NEW, Stage.INSERTED)38 self.assertLessEqual(Stage.ARCHIVED, Stage.STAGED)39 self.assertLessEqual(Stage.NEW, Stage.COMPLETED)40 self.assertLessEqual(Stage.COMPLETED, Stage.COMPLETED)41 self.assertLessEqual(Stage.INSERTED, Stage.INSERTED)42 self.assertLessEqual(Stage.INSERTED, "completed")43 self.assertLessEqual(Stage.NEW, "inserted")44 self.assertLessEqual(Stage.ARCHIVED, "staged")45 self.assertLessEqual(Stage.NEW, "completed")46 self.assertLessEqual(Stage.COMPLETED, "completed")47 self.assertLessEqual(Stage.INSERTED, "inserted")48 def test_equal(self):49 self.assertEqual(Stage.COMPLETED, Stage.COMPLETED)50 self.assertEqual(Stage.INSERTED, Stage.INSERTED)51 self.assertEqual(Stage.COMPLETED, "completed")52 self.assertEqual(Stage.INSERTED, "inserted")53 def test_different(self):54 self.assertNotEqual(Stage.INSERTED, Stage.COMPLETED)55 self.assertNotEqual(Stage.NEW, Stage.INSERTED)56 self.assertNotEqual(Stage.ARCHIVED, Stage.STAGED)57 self.assertNotEqual(Stage.NEW, Stage.COMPLETED)58 self.assertNotEqual(Stage.INSERTED, "completed")59 self.assertNotEqual(Stage.NEW, "inserted")60 self.assertNotEqual(Stage.ARCHIVED, "staged")61 self.assertNotEqual(Stage.NEW, "completed")...
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!!