How to use and_ method in Selene

Best Python code snippet using selene_python

test_when.py

Source:test_when.py Github

copy

Full Screen

...68 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))69 def create():70 def selector(a, b):71 return a + b72 return Observable.when(obs[0].and_(obs[1]).then_do(selector))73 results = scheduler.start(create)74 results.messages.assert_equal(75 on_next(210, N),76 on_completed(220)77 )78 def test_and2_error(self):79 ex = Exception()80 N = 281 for n in range(N):82 scheduler = TestScheduler()83 obs = []84 for j in range(N):85 if j == n:86 obs.append(scheduler.create_hot_observable(on_error(210, ex)))87 else:88 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))89 def create():90 def selector(a, b):91 return a + b92 return Observable.when(obs[0].and_(obs[1]).then_do(selector))93 results = scheduler.start(create)94 results.messages.assert_equal(95 on_error(210, ex)96 )97 def test_then2_throws(self):98 scheduler = TestScheduler()99 ex = Exception()100 obs = []101 N = 2102 for i in range(N):103 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))104 def create():105 def selector(a, b):106 raise ex107 return Observable.when(obs[0].and_(obs[1]).then_do(selector))108 results = scheduler.start(create)109 results.messages.assert_equal(110 on_error(210, ex)111 )112 def test_and3(self):113 scheduler = TestScheduler()114 obs = []115 N = 3116 for i in range(N):117 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))118 def create():119 def selector(a, b, c):120 return a + b + c121 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).then_do(selector))122 results = scheduler.start(create)123 results.messages.assert_equal(124 on_next(210, N),125 on_completed(220)126 )127 def test_and3_error(self):128 ex = Exception()129 N = 3130 for i in range(N):131 scheduler = TestScheduler()132 obs = []133 for j in range(N):134 if j == i:135 obs.append(scheduler.create_hot_observable(on_error(210, ex)))136 else:137 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))138 def create():139 def selector(a, b, c):140 return a + b + c141 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).then_do(selector))142 results = scheduler.start(create)143 results.messages.assert_equal(144 on_error(210, ex)145 )146 def test_then3_throws(self):147 ex = Exception()148 N = 3149 scheduler = TestScheduler()150 obs = []151 for i in range(N):152 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))153 def create():154 def selector(a, b, c):155 raise ex156 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).then_do(selector))157 results = scheduler.start(create)158 results.messages.assert_equal(159 on_error(210, ex)160 )161 def test_and4(self):162 N = 4163 scheduler = TestScheduler()164 obs = []165 for _ in range(N):166 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))167 def create():168 def selector(a, b, c, d):169 return a + b + c + d170 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).then_do(selector))171 results = scheduler.start(create)172 results.messages.assert_equal(on_next(210, N), on_completed(220))173 def test_and4_error(self):174 ex = 'ex'175 N = 4176 for i in range(N):177 scheduler = TestScheduler()178 obs = []179 for j in range(N):180 if j == i:181 obs.append(scheduler.create_hot_observable(on_error(210, ex)))182 else:183 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))184 def create():185 def selector(a, b, c, d):186 return a + b + c + d187 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).then_do(selector))188 results = scheduler.start(create)189 results.messages.assert_equal(on_error(210, ex))190 def test_then4_throws(self):191 ex = 'ex'192 N = 4193 scheduler = TestScheduler()194 obs = []195 for _ in range(N):196 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))197 def create():198 def selector(a, b, c, d):199 raise Exception(ex)200 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).then_do(selector))201 results = scheduler.start(create)202 results.messages.assert_equal(on_error(210, ex))203 def test_and5(self):204 N = 5205 scheduler = TestScheduler()206 obs = []207 for i in range(N):208 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))209 def create():210 def selector(a, b, c, d, e):211 return a + b + c + d + e212 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).then_do(selector))213 results = scheduler.start(create)214 results.messages.assert_equal(on_next(210, N), on_completed(220))215 def test_and5_error(self):216 ex = 'ex'217 N = 5218 for i in range(N):219 scheduler = TestScheduler()220 obs = []221 for j in range(N):222 if j == i:223 obs.append(scheduler.create_hot_observable(on_error(210, ex)))224 else:225 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))226 def create():227 def selector(a, b, c, d, e):228 return a + b + c + d + e229 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).then_do(selector))230 results = scheduler.start(create)231 results.messages.assert_equal(on_error(210, ex))232 def test_then5_throws(self):233 ex = 'ex'234 N = 5235 scheduler = TestScheduler()236 obs = []237 for _ in range(N):238 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))239 def create():240 def selector(a, b, c, d, e):241 raise Exception(ex)242 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).then_do(selector))243 results = scheduler.start(create)244 results.messages.assert_equal(on_error(210, ex))245 def test_and6(self):246 N = 6247 scheduler = TestScheduler()248 obs = []249 for _ in range(N):250 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))251 def create():252 def selector(a, b, c, d, e, f):253 return a + b + c + d + e + f254 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).then_do(selector))255 results = scheduler.start(create)256 results.messages.assert_equal(on_next(210, N), on_completed(220))257 def test_and6_error(self):258 ex = 'ex'259 N = 6260 for i in range(N):261 scheduler = TestScheduler()262 obs = []263 for j in range(N):264 if j == i:265 obs.append(scheduler.create_hot_observable(on_error(210, ex)))266 else:267 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))268 def create():269 def selector(a, b, c, d, e, f):270 return a + b + c + d + e + f271 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).then_do(selector))272 results = scheduler.start(create)273 results.messages.assert_equal(on_error(210, ex))274 def test_Then6Throws(self):275 ex = 'ex'276 N = 6277 scheduler = TestScheduler()278 obs = []279 for i in range(N):280 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))281 def create():282 def selector(*args):283 raise Exception(ex)284 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).then_do(selector))285 results = scheduler.start(create)286 results.messages.assert_equal(on_error(210, ex))287 def test_and7(self):288 N = 7289 scheduler = TestScheduler()290 obs = []291 for _ in range(N):292 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))293 def create():294 def selector(a, b, c, d, e, f, g):295 return a + b + c + d + e + f + g296 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).and_(obs[6]).then_do(selector))297 results = scheduler.start(create)298 results.messages.assert_equal(on_next(210, N), on_completed(220))299 def test_and7_error(self):300 ex = 'ex'301 N = 7302 for i in range(N):303 scheduler = TestScheduler()304 obs = []305 for j in range(N):306 if j == i:307 obs.append(scheduler.create_hot_observable(on_error(210, ex)))308 else:309 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))310 def create():311 def selector(a, b, c, d, e, f, g):312 return a + b + c + d + e + f + g313 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).and_(obs[6]).then_do(selector))314 results = scheduler.start(create)315 results.messages.assert_equal(on_error(210, ex))316 def test_then7_throws(self):317 ex = 'ex'318 N = 7319 scheduler = TestScheduler()320 obs = []321 for _ in range(N):322 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))323 def create():324 def selector(*args):325 raise Exception(ex)326 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).and_(obs[6]).then_do(selector))327 results = scheduler.start(create)328 results.messages.assert_equal(on_error(210, ex))329 def test_and8(self):330 N = 8331 scheduler = TestScheduler()332 obs = []333 for _ in range(N):334 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))335 def create():336 def selector(a, b, c, d, e, f, g, h):337 return a + b + c + d + e + f + g + h338 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).and_(obs[6]).and_(obs[7]).then_do(selector))339 results = scheduler.start(create)340 results.messages.assert_equal(on_next(210, N), on_completed(220))341 def test_and8_error(self):342 ex = 'ex'343 N = 8344 for i in range(N):345 scheduler = TestScheduler()346 obs = []347 for j in range(N):348 if j == i:349 obs.append(scheduler.create_hot_observable(on_error(210, ex)))350 else:351 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))352 def create():353 def selector(a, b, c, d, e, f, g, h):354 return a + b + c + d + e + f + g + h355 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).and_(obs[6]).and_(obs[7]).then_do(selector))356 results = scheduler.start(create)357 results.messages.assert_equal(on_error(210, ex))358 def test_then8_throws(self):359 ex = 'ex'360 N = 8361 scheduler = TestScheduler()362 obs = []363 for _ in range(N):364 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))365 def create():366 def selector(*args):367 raise Exception(ex)368 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).and_(obs[6]).and_(obs[7]).then_do(selector))369 results = scheduler.start(create)370 results.messages.assert_equal(on_error(210, ex))371 def test_And9(self):372 N = 9373 scheduler = TestScheduler()374 obs = []375 for i in range(N):376 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))377 def create():378 def selector(a, b, c, d, e, f, g, h, _i):379 return a + b + c + d + e + f + g + h + _i380 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).and_(obs[6]).and_(obs[7]).and_(obs[8]).then_do(selector))381 results = scheduler.start(create)382 results.messages.assert_equal(on_next(210, N), on_completed(220))383 def test_and9_error(self):384 ex = 'ex'385 N = 9386 for i in range(N):387 scheduler = TestScheduler()388 obs = []389 for j in range(N):390 if j == i:391 obs.append(scheduler.create_hot_observable(on_error(210, ex)))392 else:393 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))394 def create():395 def selector(a, b, c, d, e, f, g, h, _i):396 return a + b + c + d + e + f + g + h + _i397 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).and_(obs[6]).and_(obs[7]).and_(obs[8]).then_do(selector))398 results = scheduler.start(create)399 results.messages.assert_equal(on_error(210, ex))400 def test_then9_throws(self):401 ex = 'ex'402 N = 9403 scheduler = TestScheduler()404 obs = []405 for i in range(N):406 obs.append(scheduler.create_hot_observable(on_next(210, 1), on_completed(220)))407 def create():408 def selector(*args):409 raise Exception(ex)410 return Observable.when(obs[0].and_(obs[1]).and_(obs[2]).and_(obs[3]).and_(obs[4]).and_(obs[5]).and_(obs[6]).and_(obs[7]).and_(obs[8]).then_do(selector))411 results = scheduler.start(create)412 results.messages.assert_equal(on_error(210, ex))413 def test_WhenMultipleDataSymmetric(self):414 scheduler = TestScheduler()415 xs = scheduler.create_hot_observable(416 on_next(210, 1),417 on_next(220, 2),418 on_next(230, 3),419 on_completed(240)420 )421 ys = scheduler.create_hot_observable(422 on_next(240, 4),423 on_next(250, 5),424 on_next(260, 6),425 on_completed(270)426 )427 def create():428 def selector(x, y):429 return x + y430 return Observable.when(xs.and_(ys).then_do(selector))431 results = scheduler.start(create)432 results.messages.assert_equal(433 on_next(240, 1 + 4),434 on_next(250, 2 + 5),435 on_next(260, 3 + 6),436 on_completed(270)437 )438 def test_WhenMultipleDataAsymmetric(self):439 scheduler = TestScheduler()440 xs = scheduler.create_hot_observable(441 on_next(210, 1),442 on_next(220, 2),443 on_next(230, 3),444 on_completed(240)445 )446 ys = scheduler.create_hot_observable(447 on_next(240, 4),448 on_next(250, 5),449 on_completed(270)450 )451 def create():452 def selector(x, y):453 return x + y454 return Observable.when(xs.and_(ys).then_do(selector))455 results = scheduler.start(create)456 results.messages.assert_equal(457 on_next(240, 1 + 4),458 on_next(250, 2 + 5),459 on_completed(270)460 )461 def test_when_empty_empty(self):462 scheduler = TestScheduler()463 xs = scheduler.create_hot_observable(on_completed(240))464 ys = scheduler.create_hot_observable(on_completed(270))465 def create():466 def selector(x, y):467 return x + y468 return Observable.when(xs.and_(ys).then_do(selector))469 results = scheduler.start(create)470 results.messages.assert_equal(on_completed(270))471 def test_when_never_never(self):472 scheduler = TestScheduler()473 xs = Observable.never()474 ys = Observable.never()475 def create():476 def selector(x, y):477 return x + y478 return Observable.when(xs.and_(ys).then_do(selector))479 results = scheduler.start(create)480 results.messages.assert_equal()481 def test_when_throw_non_empty(self):482 ex = 'ex'483 scheduler = TestScheduler()484 xs = scheduler.create_hot_observable(on_error(240, ex))485 ys = scheduler.create_hot_observable(on_completed(270))486 def create():487 def selector(x, y):488 return x + y489 return Observable.when(xs.and_(ys).then_do(selector))490 results = scheduler.start(create)491 results.messages.assert_equal(on_error(240, ex))492 def test_complicated_when(self):493 scheduler = TestScheduler()494 xs = scheduler.create_hot_observable(on_next(210, 1), on_next(220, 2), on_next(230, 3), on_completed(240))495 ys = scheduler.create_hot_observable(on_next(240, 4), on_next(250, 5), on_next(260, 6), on_completed(270))496 zs = scheduler.create_hot_observable(on_next(220, 7), on_next(230, 8), on_next(240, 9), on_completed(300))497 def create():498 def sel1(x, y):499 return x + y500 def sel2(x, z):501 return x * z502 def sel3(y, z):503 return y - z504 return Observable.when(xs.and_(ys).then_do(sel1), xs.and_(zs).then_do(sel2), ys.and_(zs).then_do(sel3))505 results = scheduler.start(create)506 results.messages.assert_equal(on_next(220, 1 * 7), on_next(230, 2 * 8), on_next(240, 3 + 4), on_next(250, 5 - 9), on_completed(300))507if __name__ == '__main__':...

Full Screen

Full Screen

search.py

Source:search.py Github

copy

Full Screen

...55 print("going...")56 print(terms)57 if len(terms) > 1:58 print("PARTIAL AND")59 games_queries_and = OrderedDict([("name", and_(* [Game.name.ilike("%" + x + "%") for x in terms])),60 ("deck", and_(* [Game.deck.ilike("%" + x + "%") for x in terms])),61 ("description", and_(* [Game.description.ilike("%" + x + "%") for x in terms]))])62 companies_queries_and = OrderedDict([("name", and_(* [Company.name.ilike("%" + x + "%") for x in terms])),63 ("deck", and_(* [Company.deck.ilike("%" + x + "%") for x in terms])),64 ("description", and_(* [Company.description.ilike("%" + x + "%") for x in terms]))])65 jobs_queries_and = OrderedDict([("job_title", and_(* [Job.job_title.ilike("%" + x + "%") for x in terms])),66 ("description", and_(* [Job.description.ilike("%" + x + "%") for x in terms])),67 ("location", and_(* [Job.location.ilike("%" + x + "%") for x in terms])),68 ("company_name", and_(* [Job.company_name.ilike("%" + x + "%") for x in terms]))])69 games_and = search_models(a, request.args["s"], Game, "games", "partial match AND", "AND", games_queries_and, Game.name,70 Game.game_id)71 companies_and = search_models(a, request.args["s"], Company, "companies", "partial match AND", "AND",72 companies_queries_and, Company.name, Company.company_id)73 jobs_and = search_models(a, request.args["s"], Job, "jobs", "partial match AND", "AND", jobs_queries_and, Job.job_title,74 Job.job_id)75 a["results"] += games_and["results"] + companies_and["results"] + jobs_and["results"]76 # contains OR77 print("PARTIAL OR")78 games_queries_or = OrderedDict([("name", or_(* [Game.name.ilike("%" + x + "%") for x in terms])),79 ("deck", or_(* [Game.deck.ilike("%" + x + "%") for x in terms])),80 ("description", or_(* [Game.description.ilike("%" + x + "%") for x in terms]))])81 companies_queries_or = OrderedDict([("name", or_(* [Company.name.ilike("%" + x + "%") for x in terms])),82 ("deck", or_(* [Company.deck.ilike("%" + x + "%") for x in terms])),...

Full Screen

Full Screen

results.py

Source:results.py Github

copy

Full Screen

...33avg std min max3496706.3 2651.17 80156 9806235100318 1131.11 91302 10094036100649 1752.85 87910 10176237and_(or_(and_(IN9, or_(IN5, IN3)), and_(or_(and_(or_(and_(IN13, IN12), not_(not_(IN8))), IN16), and_(or_(and_(not_(not_(IN8)), or_(IN2, IN4)), or_(and_(and_(or_(and_(IN7, or_(IN3, IN3)), IN10), or_(and_(and_(not_(not_(IN8)), and_(or_(and_(IN7, or_(and_(IN7, or_(IN3, IN3)), not_(IN8))), IN10), or_(IN5, IN4))), IN16), IN2)), IN16), and_(or_(and_(not_(not_(IN1)), or_(IN2, and_(IN7, or_(or_(IN3, IN5), or_(and_(IN2, IN4), IN10))))), IN15), or_(IN12, and_(IN6, IN11))))), or_(IN2, and_(IN7, or_(or_(IN3, IN5), or_(and_(IN2, IN4), IN10)))))), or_(and_(or_(and_(IN7, or_(and_(IN7, or_(IN3, IN3)), or_(and_(IN6, IN8), IN10))), IN10), or_(IN5, IN4)), and_(or_(and_(or_(IN4, not_(not_(IN8))), IN16), and_(or_(and_(not_(not_(IN8)), or_(IN7, IN4)), IN15), or_(not_(not_(and_(IN13, IN3))), and_(IN6, IN11)))), IN12)))), or_(and_(or_(or_(and_(IN2, IN4), IN10), IN15), or_(not_(not_(and_(IN13, IN12))), and_(IN6, IN11))), or_(and_(and_(or_(and_(IN7, or_(IN3, IN3)), IN10), or_(and_(and_(or_(and_(IN7, or_(IN3, IN3)), IN13), and_(or_(and_(IN7, or_(and_(IN7, or_(IN3, IN3)), not_(IN8))), IN10), or_(and_(or_(and_(IN7, or_(and_(IN7, or_(IN3, IN3)), not_(IN8))), IN10), or_(IN5, IN4)), IN4))), IN16), IN2)), IN16), and_(or_(and_(not_(not_(IN1)), or_(IN2, and_(IN7, or_(or_(IN3, IN5), or_(and_(IN2, IN4), IN10))))), IN15), or_(not_(not_(IN8)), and_(IN6, IN11))))))3898445.8 491.316 95088 988623992616.2 2998.54 74400 938804096612.7 3473.9 73164 984344196469.9 1417.88 87818 976344298469.3 2206.32 87930 996764397442.4 2274.31 83064 98402...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Selene automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful