How to use process_message method in avocado

Best Python code snippet using avocado_python

main.py

Source:main.py Github

copy

Full Screen

...54 return 055 5657# --------------------- ADD ANSWER PROCESSING FUNCTIONS WITH 'answer+=module.feature ------------------------58def process_message(texto,nombre,ID,stage):59 #stage = 060 answer =''61 if stage == 0:62 answer = greetings.greet(texto,nombre)63 if answer == "I beg your pardon? Type '/start' to begin the experience":64 return 0,answer65 stage += 166 return stage,answer67 elif stage == 1:68 if database.isKnown(ID,nombre) == False:69 answer = greetings.greet_answer(texto,nombre,ID)70 answer += greetings.begin_details_age(texto,nombre,ID)71 stage += 172 return stage,answer73 else:74 answer = greetings.greet_answer(texto,nombre,ID)75 stage = 647677 elif stage == 2:78 age,answer = greetings.ask_country(texto,nombre,ID)79 stage += 180 return stage,answer,age81 82 elif stage == 3:83 country,answer = greetings.ask_language(texto,nombre,ID)84 stage += 185 return stage,answer,country86 87 elif stage == 4:88 language,answer = greetings.launch_personnality(texto,nombre,ID)89 stage += 190 return stage,answer,language91 92 elif stage == 5:93 r1,answer = personality.q1(texto,nombre,ID)94 stage += 195 return stage,answer,r196 97 elif stage == 6:98 r2,answer = personality.q2(texto,nombre,ID)99 stage += 1100 return stage,answer,r2101102 elif stage == 7:103 r3,answer = personality.q3(texto,nombre,ID)104 stage += 1105 return stage,answer,r3106107 elif stage == 8:108 r4,answer = personality.q4(texto,nombre,ID)109 stage += 1110 return stage,answer,r4111112 elif stage == 9:113 r5,answer = personality.q5(texto,nombre,ID)114 stage += 1115 return stage,answer,r5116117 elif stage == 10:118 r6,answer = personality.q6(texto,nombre,ID)119 stage += 1120 return stage,answer,r6121 122 elif stage == 11:123 r7,answer = personality.q7(texto,nombre,ID)124 stage += 1125 return stage,answer,r7126 127 elif stage == 12:128 r8,answer = personality.q8(texto,nombre,ID)129 stage += 1130 return stage,answer,r8131132 elif stage == 13:133 r9,answer = personality.q9(texto,nombre,ID)134 stage += 1135 return stage,answer,r9136 137 elif stage == 14:138 r10,answer = personality.q10(texto,nombre,ID)139 stage += 1140 return stage,answer,r10141 142 elif stage == 15:143 r11,answer = personality.q11(texto,nombre,ID)144 stage += 1145 return stage,answer,r11146 147 elif stage == 16:148 r12,answer = personality.q12(texto,nombre,ID)149 stage += 1150 return stage,answer,r12151 152 elif stage == 17:153 r13,answer = personality.q13(texto,nombre,ID)154 stage += 1155 return stage,answer,r13156 157 elif stage == 18:158 r14,answer = personality.q14(texto,nombre,ID)159 stage += 1160 return stage,answer,r14161 162 elif stage == 19:163 r15,answer = personality.q15(texto,nombre,ID)164 stage += 1165 return stage,answer,r15166 167 elif stage == 20:168 r16,answer = personality.q16(texto,nombre,ID)169 stage += 1170 return stage,answer,r16171 172 elif stage == 21:173 r17,answer = personality.q17(texto,nombre,ID)174 stage += 1175 return stage,answer,r17176 177 elif stage == 22:178 r18,answer = personality.q18(texto,nombre,ID)179 stage += 1180 return stage,answer,r18181 182 elif stage == 23:183 r19,answer = personality.q19(texto,nombre,ID)184 stage += 1185 return stage,answer,r19186 187 elif stage == 24:188 r20,answer = personality.q20(texto,nombre,ID)189 stage += 1190 return stage,answer,r20191 192 elif stage == 25:193 r21,answer = personality.q21(texto,nombre,ID)194 stage += 1195 return stage,answer,r21196 197 elif stage == 26:198 r22,answer = personality.q22(texto,nombre,ID)199 stage += 1200 return stage,answer,r22201 202 elif stage == 27:203 r23,answer = personality.q23(texto,nombre,ID)204 stage += 1205 return stage,answer,r23206 207 elif stage == 28:208 r24,answer = personality.q24(texto,nombre,ID)209 stage += 1210 return stage,answer,r24211 212 elif stage == 29:213 r25,answer = personality.q25(texto,nombre,ID)214 stage += 1215 return stage,answer,r25216 217 elif stage == 30:218 r26,answer = personality.q26(texto,nombre,ID)219 stage += 1220 return stage,answer,r26221 222 elif stage == 31:223 r27,answer = personality.q27(texto,nombre,ID)224 stage += 1225 return stage,answer,r27226 227 elif stage == 32:228 r28,answer = personality.q28(texto,nombre,ID)229 stage += 1230 return stage,answer,r28231 232 elif stage == 33:233 r29,answer = personality.q29(texto,nombre,ID)234 stage += 1235 return stage,answer,r29236 237 elif stage == 34:238 r30,answer = personality.q30(texto,nombre,ID)239 stage += 1240 return stage,answer,r30241 242 elif stage == 35:243 r31,answer = personality.q31(texto,nombre,ID)244 stage += 1245 return stage,answer,r31246 247 elif stage == 36:248 r32,answer = personality.q32(texto,nombre,ID)249 stage += 1250 return stage,answer,r32251 252 elif stage == 37:253 r33,answer = personality.q33(texto,nombre,ID)254 stage += 1255 return stage,answer,r33256 257 elif stage == 38:258 r34,answer = personality.q34(texto,nombre,ID)259 stage += 1260 return stage,answer,r34261 262 elif stage == 39:263 r35,answer = personality.q35(texto,nombre,ID)264 stage += 1265 return stage,answer,r35266 267 elif stage == 40:268 r36,answer = personality.q36(texto,nombre,ID)269 stage += 1270 return stage,answer,r36271 272 elif stage == 41:273 r37,answer = personality.q37(texto,nombre,ID)274 stage += 1275 return stage,answer,r37276 277 elif stage == 42:278 r38,answer = personality.q38(texto,nombre,ID)279 stage += 1280 return stage,answer,r38281 282 elif stage == 43:283 r39,answer = personality.q39(texto,nombre,ID)284 stage += 1285 return stage,answer,r39286 287 elif stage == 44:288 r40,answer = personality.q40(texto,nombre,ID)289 stage += 1290 return stage,answer,r40291 292 elif stage == 45:293 r41,answer = personality.q41(texto,nombre,ID)294 stage += 1295 return stage,answer,r41296 297 elif stage == 46:298 r42,answer = personality.q42(texto,nombre,ID)299 stage += 1300 return stage,answer,r42301 302 elif stage == 47:303 r43,answer = personality.q43(texto,nombre,ID)304 stage += 1305 return stage,answer,r43306 307 elif stage == 48:308 r44,answer = personality.q44(texto,nombre,ID)309 stage += 1310 return stage,answer,r44311 312 elif stage == 49:313 r45,answer = personality.q45(texto,nombre,ID)314 stage += 1315 return stage,answer,r45316 317 elif stage == 50:318 r46,answer = personality.q46(texto,nombre,ID)319 stage += 1320 return stage,answer,r46321 322 elif stage == 51:323 r47,answer = personality.q47(texto,nombre,ID)324 stage += 1325 return stage,answer,r47326 327 elif stage == 52:328 r48,answer = personality.q48(texto,nombre,ID)329 stage += 1330 return stage,answer,r48331 332 elif stage == 53:333 r49,answer = personality.q49(texto,nombre,ID)334 stage += 1335 return stage,answer,r49336 337 elif stage == 54:338 r50,answer = personality.q50(texto,nombre,ID)339 stage += 1340 return stage,answer,r50341 342 elif stage == 55:343 stage += 1344 return stage345 346 if stage == 56:347 answer += '\n\n'+questions.ask_Netflix(texto,nombre,ID)348 349 elif stage == 57:350 answer,netflix = questions.ask_Hulu(texto,nombre,ID)351 stage += 1352 return stage,answer,netflix353 354 elif stage == 58:355 answer,hulu = questions.ask_Prime(texto,nombre,ID)356 stage += 1357 return stage,answer,hulu358 359 elif stage == 59:360 answer,prime = questions.ask_Disney(texto,nombre,ID)361 stage += 1362 return stage,answer,prime363364 elif stage == 60:365 answer,disney = questions.performing(texto,nombre,ID)366 stage += 1367 return stage,answer,disney368 369 elif stage == 61:370 stage += 1371 return stage372373 elif stage == 62:374 answer = questions.ask_recentness(texto,nombre,ID)375 stage += 1376 return stage,answer377 378 elif stage == 63:379 answer = questions.ask_other(texto,nombre,ID)380 stage += 5 # add any number to jump up to 'how many movies do you want me to suggest ?'381 382 elif stage == 64:383 answer += recommend.ask_seen(texto,nombre,ID)384 stage += 1385 return stage,answer386387 elif stage == 65:388 if re.findall('[0-9]+', texto) != []:389 answer = recommend.ask_liked(texto,nombre,ID)390 stage += 1391 return stage,answer392 else:393 answer = 'Please type at least one of the above numbers.'394 return stage,answer395396 elif stage == 66:397 if re.findall('[0-9]+', texto) != []:398 answer = recommend.ask_disliked(texto,nombre,ID)399 stage += 1400 return stage,answer401 else:402 answer = 'Please type at least one of the above numbers.'403 return stage,answer404 405 elif stage == 67:406 if re.findall('[0-9]+', texto) != []:407 answer = recommend.process_feedback(texto,nombre,ID)408 stage += 1409 return stage,answer410 else:411 answer = 'Please type at least one of the above numbers.'412 return stage,answer413414415416 elif stage == 68:417 answer += "How many movies do you want me to suggest ?"418419 elif stage == 69:420 stage += 1421 return stage422 423 elif stage == 70:424 stage += 1425 return stage426427428429 #else:430 # answer = end.bye(texto,nombre,id)431 # if answer != '':432 # return -1,answer433 434 stage += 1435 return stage,answer436437 438#Variable para almacenar la ID del ultimo mensaje procesado439ultima_id = 0440441stage = 0442n_best = 0443platforms = []444445while(stage >= 0):446 mensajes_diccionario = update(ultima_id)447 448 with open('updates.json','w') as json_file:449 json.dump(mensajes_diccionario,json_file,indent=4, sort_keys=True)450 451 for i in mensajes_diccionario["result"]:452 if ('message' in i.keys()):453 #Llamar a la funcion "leer_mensaje()"454 id_chat, nombre, texto, id_update = leer_mensaje(i)455 if id_chat != 1690350938:456 continue457 #Si la ID del mensaje es mayor que el ultimo, se guarda la ID + 1458 if id_update > (ultima_id-1):459 ultima_id = id_update + 1460461 answer = ''462 print(stage,texto)463 464 if stage == 2:465 stage,answer,age = process_message(texto,nombre,id_chat,stage)466 elif stage == 3:467 stage,answer,country = process_message(texto,nombre,id_chat,stage)468 elif stage == 4:469 stage,answer,language = process_message(texto,nombre,id_chat,stage)470 res = database.newUser(id_chat,nombre,age,country,language)471 elif stage == 5:472 res = []473 stage,answer,r1 = process_message(texto,nombre,id_chat,stage)474 res.append(r1)475 elif stage == 6:476 stage,answer,r2 = process_message(texto,nombre,id_chat,stage)477 res.append(r2)478 elif stage == 7:479 stage,answer,r3 = process_message(texto,nombre,id_chat,stage)480 res.append(r3)481 elif stage == 8:482 stage,answer,r4 = process_message(texto,nombre,id_chat,stage)483 res.append(r4)484 elif stage == 9:485 stage,answer,r5 = process_message(texto,nombre,id_chat,stage)486 res.append(r5)487 elif stage == 10:488 stage,answer,r6 = process_message(texto,nombre,id_chat,stage)489 res.append(r6)490 elif stage == 11:491 stage,answer,r7 = process_message(texto,nombre,id_chat,stage)492 res.append(r7)493 elif stage == 12:494 stage,answer,r8 = process_message(texto,nombre,id_chat,stage)495 res.append(r8)496 elif stage == 13:497 stage,answer,r9 = process_message(texto,nombre,id_chat,stage)498 res.append(r9)499 elif stage == 14:500 stage,answer,r10 = process_message(texto,nombre,id_chat,stage)501 res.append(r10)502 elif stage == 15:503 stage,answer,r11 = process_message(texto,nombre,id_chat,stage)504 res.append(r11)505 elif stage == 16:506 stage,answer,r12 = process_message(texto,nombre,id_chat,stage)507 res.append(r12)508 elif stage == 17:509 stage,answer,r13 = process_message(texto,nombre,id_chat,stage)510 res.append(r13)511 elif stage == 18:512 stage,answer,r14 = process_message(texto,nombre,id_chat,stage)513 res.append(r14)514 elif stage == 19:515 stage,answer,r15 = process_message(texto,nombre,id_chat,stage)516 res.append(r15)517 elif stage == 20:518 stage,answer,r16 = process_message(texto,nombre,id_chat,stage)519 res.append(r16)520 elif stage == 21:521 stage,answer,r17 = process_message(texto,nombre,id_chat,stage)522 res.append(r17)523 elif stage == 22:524 stage,answer,r18 = process_message(texto,nombre,id_chat,stage)525 res.append(r18)526 elif stage == 23:527 stage,answer,r19 = process_message(texto,nombre,id_chat,stage)528 res.append(r19)529 elif stage == 24:530 stage,answer,r20 = process_message(texto,nombre,id_chat,stage)531 res.append(r20)532 elif stage == 25:533 stage,answer,r21 = process_message(texto,nombre,id_chat,stage)534 res.append(r21)535 elif stage == 26:536 stage,answer,r22 = process_message(texto,nombre,id_chat,stage)537 res.append(r22)538 elif stage == 27:539 stage,answer,r23 = process_message(texto,nombre,id_chat,stage)540 res.append(r23)541 elif stage == 28:542 stage,answer,r24 = process_message(texto,nombre,id_chat,stage)543 res.append(r24)544 elif stage == 29:545 stage,answer,r25 = process_message(texto,nombre,id_chat,stage)546 res.append(r25)547 elif stage == 30:548 stage,answer,r26 = process_message(texto,nombre,id_chat,stage)549 res.append(r26)550 elif stage == 31:551 stage,answer,r27 = process_message(texto,nombre,id_chat,stage)552 res.append(r27)553 elif stage == 32:554 stage,answer,r28 = process_message(texto,nombre,id_chat,stage)555 res.append(r28)556 elif stage == 33:557 stage,answer,r29 = process_message(texto,nombre,id_chat,stage)558 res.append(r29)559 elif stage == 34:560 stage,answer,r30 = process_message(texto,nombre,id_chat,stage)561 res.append(r30)562 elif stage == 35:563 stage,answer,r31 = process_message(texto,nombre,id_chat,stage)564 res.append(r31)565 elif stage == 36:566 stage,answer,r32 = process_message(texto,nombre,id_chat,stage)567 res.append(r32)568 elif stage == 37:569 stage,answer,r33 = process_message(texto,nombre,id_chat,stage)570 res.append(r33)571 elif stage == 38:572 stage,answer,r34 = process_message(texto,nombre,id_chat,stage)573 res.append(r34)574 elif stage == 39:575 stage,answer,r35 = process_message(texto,nombre,id_chat,stage)576 res.append(r35)577 elif stage == 40:578 stage,answer,r36 = process_message(texto,nombre,id_chat,stage)579 res.append(r36)580 elif stage == 41:581 stage,answer,r37 = process_message(texto,nombre,id_chat,stage)582 res.append(r37)583 elif stage == 42:584 stage,answer,r38 = process_message(texto,nombre,id_chat,stage)585 res.append(r38)586 elif stage == 43:587 stage,answer,r39 = process_message(texto,nombre,id_chat,stage)588 res.append(r39)589 elif stage == 44:590 stage,answer,r40 = process_message(texto,nombre,id_chat,stage)591 res.append(r40)592 elif stage == 45:593 stage,answer,r41 = process_message(texto,nombre,id_chat,stage)594 res.append(r41)595 elif stage == 46:596 stage,answer,r42 = process_message(texto,nombre,id_chat,stage)597 res.append(r42)598 elif stage == 47:599 stage,answer,r43 = process_message(texto,nombre,id_chat,stage)600 res.append(r43)601 elif stage == 48:602 stage,answer,r44 = process_message(texto,nombre,id_chat,stage)603 res.append(r44)604 elif stage == 49:605 stage,answer,r45 = process_message(texto,nombre,id_chat,stage)606 res.append(r45)607 elif stage == 50:608 stage,answer,r46 = process_message(texto,nombre,id_chat,stage)609 res.append(r46)610 elif stage == 51:611 stage,answer,r47 = process_message(texto,nombre,id_chat,stage)612 res.append(r47)613 elif stage == 52:614 stage,answer,r48 = process_message(texto,nombre,id_chat,stage)615 res.append(r48)616 elif stage == 53:617 stage,answer,r49 = process_message(texto,nombre,id_chat,stage)618 res.append(r49)619 elif stage == 54:620 stage,answer,r50 = process_message(texto,nombre,id_chat,stage)621 res.append(r50)622 elif stage == 55:623 answer,r = personality.results(texto,nombre,id_chat,res)624 stage += 1625 #elif stage == 56:626 # stage,answer = process_message(texto,nombre,id_chat,stage)627 elif stage == 57:628 stage,answer,netflix = process_message(texto,nombre,id_chat,stage)629 platforms.append(netflix)630 elif stage == 58:631 stage,answer,hulu = process_message(texto,nombre,id_chat,stage)632 platforms.append(hulu)633 elif stage == 59:634 stage,answer,prime = process_message(texto,nombre,id_chat,stage)635 platforms.append(prime)636 elif stage == 60:637 stage,answer,disney = process_message(texto,nombre,id_chat,stage)638 platforms.append(disney)639 elif stage == 61:640 if platforms == [0,0,0,0]:641 answer += 'As you don\'t have access to any streaming platform, we cannot guarantee that you will have access to the recommended movies'642 answer += '\n'+questions.platforms_saved(texto,nombre,id_chat,platforms)643 stage += 1644 elif stage == 69:645 answer,nb = questions.ask_n_best(texto,nombre,id_chat)646 stage += 1647 n_best = nb648 elif stage == 70:649 recom,answer = recommend.take_n_best(texto,nombre,id_chat,n_best)650 stage += 1651 elif stage == 71:652 if re.search('bye', texto, re.IGNORECASE)!=None:653 answer = end.bye(texto,nombre,id)654 stage = -1655 elif re.search('start', texto, re.IGNORECASE)!=None:656 stage = 0657 answer = 'Please now type \'/start\' to begin again'658 else:659 answer = 'I beg your pardon ?'660 661662 else:663 stage,answer = process_message(texto,nombre,id_chat,stage)664665 if answer!='':666 enviar_mensaje(id_chat,answer)667 if stage == -1:668 break669 else:670 continue671 else:672 pass673 674 675 676 677 ...

Full Screen

Full Screen

test_base.py

Source:test_base.py Github

copy

Full Screen

...36 """Return a level 1 descendant."""37 return Level1(options, None, None, None)38def test_direct_collection(level1, caplog):39 """Test direct collection."""40 level1.process_message(deque(), {"info": 1})41 level1.process_message(deque(["2"]), {"info": 1})42 level1.process_message(deque(["2", "3"]), {"hello": 1})43 assert level1.get_level2(2).get_level3(3).hello == 144 # Only works on numbers45 level1.process_message(deque(["2", "a"]), {"hello": 1})46 assert level1.get_level2(2).get_level3("a") is None47 assert "cannot process message" in caplog.text48def test_pending_messages(level1, options):49 """Test pending messages."""50 events = []51 options.notify = lambda event, data: events.append(event)52 # Only message for level3 has been received, level2 is none53 level1.process_message(deque(["2", "3"]), {"hello": 1})54 assert level1.get_level2(2) is None55 assert not events56 # Message for level2, level3 received, level1 still None57 level1.process_message(deque(["2"]), {"hello": 1})58 assert level1.get_level2(2) is None59 assert not events60 # Level 1 receives data, process all child messages.61 level1.process_message(deque(), {"info": 1})62 assert level1.get_level2(2).get_level3(3).hello == 163 assert events == ["level2_added", "level3_added"]64def test_recursive_remove(level1, options):65 """Test recursive remove."""66 events = []67 level1.process_message(deque(), {"info": 1})68 level1.process_message(deque(["2"]), {"info": 1})69 level1.process_message(deque(["2", "3"]), {"hello": 1})70 options.notify = lambda event, data: events.append(event)71 level1.process_message(deque(["2"]), base.EMPTY_PAYLOAD)72 assert events == ["level3_removed", "level2_removed"]73def test_topic(options):74 """Test topic property."""75 class Level4(base.ZWaveBase):76 """Represent a level 4 descendant."""77 EVENT_ADDED = "level4_added"78 EVENT_CHANGED = "level4_change"79 EVENT_REMOVED = "level4_removed"80 class Level3Statistics(base.ZWaveBase):81 """Represent level 3 statistics."""82 EVENT_CHANGED = "level3statistics_change"83 # Patch in a non-direct collection84 with patch.object(85 Level3,86 "create_collections",87 lambda _: {88 "level4": base.ItemCollection(Level4),89 "statistics": Level3Statistics,90 },91 ):92 level1 = Level1(options, None, None, None)93 level1.process_message(deque(), {"info": 1})94 level1.process_message(deque(["2"]), {"info": 1})95 level1.process_message(deque(["2", "3"]), {"hello": 1})96 level1.process_message(deque(["2", "3", "level4", "4"]), {"hello": 1})97 level1.process_message(deque(["2", "3", "statistics"]), {"hello": 1})98 assert (99 level1.get_level2(2) # pylint: disable=no-member100 .get_level3(3)101 .get_level4(4)102 .topic103 == "OpenZWave/2/3/level4/4"104 )105 assert (106 level1.get_level2(2) # pylint: disable=no-member107 .get_level3(3)108 .get_statistics()109 .topic110 == "OpenZWave/2/3/statistics"111 )112def test_automatic_collections(level1):113 """Test automatic collections."""114 level1.process_message(deque(), {"info": 1})115 level1.process_message(deque(["2"]), {"info": 1})116 level1.process_message(deque(["2", "3"]), {"hello": 1})117 # Test overridden using PLURAL_NAME118 assert list(level1.level_twos()) == [level1.get_level2(2)]119 # Test default name120 assert list(level1.get_level2(2).level3s()) == [level1.get_level2(2).get_level3(3)]121def test_warn_unhandled(level1, caplog):122 """Test warn unhandled."""123 level1.process_message(deque(), {"info": 1})124 level1.process_message(deque(["2"]), {"info": 1})125 level1.process_message(deque(["2", "something"]), {"info": 1})126 assert (127 "Level2 cannot process message OpenZWave/2/something: {'info': 1}"128 in caplog.text129 )130def test_discarder(level1, options, caplog):131 """Test we can discard messages."""132 with patch.object(133 Level1, "create_collections", lambda _: {"command": base.DiscardMessages()}134 ):135 level1 = Level1(options, None, None, None)136 level1.process_message(deque(), {"info": 1})137 level1.process_message(deque(["command"]), {"info": 1})138 assert "cannot process message" not in caplog.text139def test_events(level1, options):140 """Test we can fire events messages."""141 events = []142 options.notify = lambda event, data: events.append((event, data))143 with patch.object(144 Level1,145 "create_collections",146 lambda _: {147 "event": base.EventMessages(148 options, "super_event", lambda topic, msg: topic[0]149 )150 },151 ):152 level1 = Level1(options, None, None, None)153 level1.process_message(deque(), {"info": 1})154 level1.process_message(155 deque(["event", "test-event-type"]), {"data": "for-event"}156 )157 assert len(events) == 1158 event, data = events[0]159 assert event == "super_event"160 assert data == {"event": "test-event-type", "data": {"data": "for-event"}}161def test_repr():162 """Test repr function."""163 class TestNode(base.ZWaveBase):164 """Represent a test node."""165 EVENT_CHANGED = "bla"166 inst = TestNode(None, None, "mock-topic-part", "mock-id")...

Full Screen

Full Screen

lines.py

Source:lines.py Github

copy

Full Screen

...11 ##logger.info(f"DEBUG (lines 1) Lines init")12 self.red_line = Line("red")13 self.green_line = Line("green")14 self.blue_line = Line("blue")15 def process_message(self, message):16 """Processes a station message"""17 print(f"DEBUG {message.topic()}")18 if "com.udacity.station" in message.topic():19 value = message.value()20 elif message.topic() == "connect.stations.table":21 value = json.loads(value)22 if value["line"] == "green":23 self.green_line.process_message(message)24 elif value["line"] == "red":25 self.red_line.process_message(message)26 elif value["line"] == "blue":27 self.blue_line.process_message(message)28 else:29 logger.info("discarding unknown line msg %s", value["line"])30 31 if message.topic() == "TURNSTILE_SUMMARY":32 self.green_line.process_message(message)33 self.red_line.process_message(message)34 self.blue_line.process_message(message)35 else:36 logger.info("ignoring non-lines message %s", message.topic())37 38 39# """Processes a station message"""40# logger.info(f"DEBUG (lines 2) {self.message}")41# ## if "org.chicago.cta.station" in message.topic():42# if "com.udacity.station" in message.topic():43# logger.info(f"DEBUG (lines 3a) {message.topic()}")44# value = message.value()45# ## if message.topic() == "org.chicago.cta.stations.table.v1":46# elif message.topic() == "connect.stations.table":47# value = json.loads(message)48# logger.info(f"DEBUG (lines 3b) {value}")49# if value["line"] == "green":50# self.green_line.process_message(message)51# elif value["line"] == "red":52# self.red_line.process_message(message)53# elif value["line"] == "blue":54# self.blue_line.process_message(message)55# else:56# logger.debug("discarding unknown line msg %s", value["line"])57# elif "TURNSTILE_SUMMARY" == message.topic():58# logger.info("DEBUG (lines 3c) %s", message.topic())59# self.green_line.process_message(message)60# self.red_line.process_message(message)61# self.blue_line.process_message(message)62# else:...

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 avocado 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