Best Python code snippet using pyatom_python
seconRoom.py
Source:seconRoom.py  
...93                    elif escolha == "nao":94                        print("Você achou melhor guardar a chave.")95                sleep(2)96                clear.clearSystem()97                clear.clearAll()98            elif escolha == 2:99                sleep(1)100                print("Qual item deseja vasculhar?\n\n",101                      "[1] - Cadeira\n",102                      "[2] - Espelho\n",103                      "[3] - Quadro\n",104                      "[4] - Bau\n",105                      "[5] - Estátua\n",106                      "[6] - Bolsa de remédios")107                sleep(1)108                print()109                objetos = int(input('>> '))110                print()111                if objetos == 1:112                    print("Você deseja: \n\n",113                          "[1] - Vasculhar cadeira\n",114                          "[2] - Quebrar a cadeira\n",115                          "[3] - Sentar na cadeira\n",)116                    opcaoCadeira = int(input(">> "))117                    if opcaoCadeira == 1:118                        relogio.corretempo(2)119                        print()120                        print(121                            "Você encontrou uma carta grudada na cadeira, deseja ler? [sim/não]\n")122                        ler = input('>> ').upper()123                        if ler == 'SIM':124                            carta = '''\033[32m125        ââââââââââââââââââââââââââââââââââââââââ126        ââââââââââââââââââââââââââââââââââââââââ127        ââââââââââââââââââââââââââââââââââââââââ128        ââââââââââââââââââââââââââââââââââââââââ129        ââââââââââââââââââââââââââââââââââââââââ130        ââââââââââââââââââââââââââââââââââââââââ131        ââââââââââââââââââââââââââââââââââââââââ132        ââââââââââââââââââââââââââââââââââââââââ133        ââââââââââââââââââââââââââââââââââââââââ134        ââââââââââââââââââââââââââââââââââââââââ135        ââââââââââââââââââââââââââââââââââââââââ136        ââââââââââââââââââââââââââââââââââââââââ137        ââââââââââââââââââââââââââââââââââââââââ138        ââââââââââââââââââââââââââââââââââââââââ139        ââââââââââââââââââââââââââââââââââââââââ140        ââââââââââââââââââââââââââââââââââââââââ141        ââââââââââââââââââââââââââââââââââââââââ142        ââââââââââââââââââââââââââââââââââââââââ143        ââââââââââââ âââââââââââââââ ââââââââââââ144        ââââââââââââââââââââââââââââââââââââââââ\033[m\n\n'''145                            print(carta)146                            fraseAnimation = '\nQual o significado desse simbolo?\n\n'147                            self.animation(fraseAnimation)148                            fraseAnimation = 'Começamos bem, porém ainda não encontramos uma forma de sair daqui, vamos continuar'149                            self.animation(fraseAnimation)150                            sleep(2)151                            clear.clearSystem()152                            clear.clearAll()153                            relogio.corretempo(2)154                        else:155                            fraseAnimation = 'Ok, vamos continuar'156                            self.animation(fraseAnimation)157                            sleep(2)158                            clear.clearSystem()159                            clear.clearAll()160                            relogio.corretempo(2)161                    elif opcaoCadeira == 2:162                        relogio.corretempo(2)163                        fraseAnimation = '''Você quebrou a cadeira na parede, mas um pedaço de farpa machucou seu braço164Você percebeu que nos pedaços de madeira quebrados tem uma carta, deseja ler?\n\n'''165                        self.animation(fraseAnimation)166                        ler = input('>> ').upper()167                        sleep(2)168                        if ler == 'SIM':169                            fraseAnimation = '''Você está um pouco zonzo, e esta perdendo tempo lendo essa carta, vá enfaixar seu braço170Caso contrário perderá mais {}tempo{} que o normal\n\n'''.format(cores['red'], cores['limpa'])171                            self.animation(fraseAnimation)172                            machucado = True173                            sleep(2)174                            clear.clearSystem()175                            clear.clearAll()176                            relogio.corretempo(2)177                        else:178                            print('OK!')179                            sleep(2)180                            relogio.corretempo(2)181                            clear.clearSystem()182                            clear.clearAll()183                    elif opcaoCadeira == 3:184                        relogio.corretempo(2)185                        print('Que situação maluca, descansar é sempre bom!\n',186                              'Você conseguiu enxergar o reflexo de alguma coisa\n')187                        sleep(2)188                        print("Para onde está olhando?\n\n",189                              "[1] - Cadeira\n",190                              "[2] - Espelho\n",191                              "[3] - Quadro\n",192                              "[4] - Bau\n",193                              "[5] - Estátua\n",194                              "[6] - Bolsa de remédios\n")195                        opcaoEspelho = int(input('>> '))196                        if opcaoEspelho == 2:197                            print('Você olha para o espelho e vê:\n')198                            visualizar = randint(1, 6)199                            if visualizar == 3:200                                print('Um Dinossauro')201                                sleep(1)202                                fraseAnimation = 'Você está muito cansado, é impossÃvel isso estar na sala, descanse 5 minutos!\n\n'203                                self.animation(fraseAnimation)204                                relogio.corretempo(5)205                                sleep(2)206                                clear.clearSystem()207                                clear.clearAll()208                            elif visualizar == 2:209                                fraseAnimation = 'Um guarda-roupa?\n\n'210                                self.animation(fraseAnimation)211                                relogio.corretempo(4)212                                sleep(2)213                                clear.clearSystem()214                                clear.clearAll()215                            else:216                                print('A sala realmente tem uma estatua, o que quer fazer?\n',217                                      '[1] - Olhar a estatua\n',218                                      '[2] - Girar a estatua\n',219                                      '[3] - Não fazer nada\n')220                                estatua = int(input('>>> '))221                                sleep(2)222                                if estatua == 1:223                                    fraseAnimation = 'Nada de diferente aconteceu, talvez fosse apenas uma impressão sua...\n\n'224                                    self.animation(fraseAnimation)225                                    relogio.corretempo(1)226                                    sleep(2)227                                    clear.clearSystem()228                                    clear.clearAll()229                                elif estatua == 2:  # =================\\ 1° FINAL //============================230                                    fraseAnimation = '''Boa escolha, você girou a estatua com delicadeza231Um buraco se abre no peito da estátua232lhe dando acesso a {}chave{} que abre a porta de saÃda ...\n\n'''.format(cores['ciano'], cores['limpa'])233                                    self.animation(fraseAnimation)234                                    relogio.corretempo(4)235                                    self.chavePorta = True236                                    sleep(2)237                                    clear.clearSystem()238                                    clear.clearAll()239                                elif estatua == 3:240                                    relogio.corretempo(4)241                                    continue242                        else:243                            print('OK!')244                            relogio.corretempo(4)245                            sleep(2)246                            clear.clearSystem()247                            clear.clearAll()248                elif objetos == 2 and lembranca == True:249                    print('O que você vê no espelho?\n',250                          '[1] - Estátua\n',251                          '[2] - Baú\n',252                          '[3] - Seu reflexo')253                    acaoEspelho = int(input(">> "))254                    if acaoEspelho == 3:255                        fraseAnimation = '''Ao se olhar você começa a se lembrar do que realmente aconteceu!256Você estava em uma estrada com sua famÃlia e um caminhão entrou na pista257Aparentemente o caminhoneiro estava embriagado e causou um acidente258Você e sua familia vivenciaram um trauma muito grande, e nesse momento259Você está em uma cama de hospital...\n\n'''260                        self.animation(fraseAnimation)261                        sleep(2)262                        relogio.corretempo(3)263                        clear.clearSystem()264                        clear.clearAll()265                    else:266                        print('OK!')267                        sleep(2)268                        clear.clearSystem()269                        clear.clearAll()270                elif objetos == 2:271                    print('O que você viu no espelho?\n',272                          '[1] - Seu próprio reflexo\n',273                          '[2] - Quadro \n',274                          '[3] - Violão')275                    visualizar = int(input('>> '))276                    sleep(2)277                    if visualizar == 1:278                        fraseAnimation = '''Você é uma pessoa muito bonita, porém279já tem problemas o suficiente para ficar se olhando no espelho\n\n'''280                        self.animation(fraseAnimation)281                        relogio.corretempo(5)282                        sleep(2)283                        clear.clearSystem()284                        clear.clearAll()285                    elif visualizar == 2:286                        quadro = input(287                            'Deseja chegar mais perto? [sim/não]').upper()288                        print()289                        sleep(1)290                        if quadro == 'SIM':291                            fraseAnimation = 'O quadro da sala é uma figura estranha, quem será?\n\n'292                            self.animation(fraseAnimation)293                            relogio.corretempo(5)294                            quadr = '''{}295            âââââââââââââââââââââââââââââ296            âââââââââââââââââââââââââââââ297            âââââââââââââââââââââââââââââ298            âââââââââââââââââââââââââââââ299            âââââââââââââââââââââââââââââ300            âââââââââââââââââââââââââââââ301            âââââââââââââââââââââââââââââ302            âââââââââââââââââââââââââââââ303            âââââââââââââââââââââââââââââ304            âââââââââââââââââââââââââââââ305            âââââââââââââââââââââââââââââ306            âââââââââââââââââââââââââââââ307            âââââââââââââââââââââââââââââ308            âââââââââââââââââââââââââââââ309            âââââââââââââââââââââââââââââ310            âââââââââââââââââââââââââââââ311            âââââââââââââââââââââââââââââ312            âââââââââââââââââââââââââââââ313            âââââââââââââââââââââââââââââ314            âââââââââââââââââââââââââââââ315            âââââââââââââââââââââââââââââ316            âââââââââââââââââââââââââââââ317            âââââââââââââââââââââââââââââ318            âââââââââââââââââââââââââââââ319            âââââââââââââââââââââââââââââ320            âââââââââââââââââââââââââââââ321            âââââââââââââââââââââââââââââ322            âââââââââââââââââââââââââââââ323            âââââââââââââââââââââââââââââ324            âââââââââââââââââââââââââââââ325            âââââââââââââââââââââââââââââ326            âââââââââââââââââââââââââââââ327            âââââââââââââââââââââââââââââ328            âââââââââââââââââââââââââââââ329            âââââââââââââââââââââââââââââ330            âââââââââââââââââââââââââââââ331            âââââââââââââââââââââââââââââ332            âââââââââââââââââââââââââââââ333            âââââââââââââââââââââââââââââ334            âââââââââââââââââââââââââââââ335            âââââââââââââââââââââââââââââ336            âââââââââââââââââââââââââââââ337            âââââââââââââââââââââââââââââ338            âââââââââââââââââââââââââââââ339            âââââââââââââââââââââââââââââ340            âââââââââââââââââââââââââââââ341            âââââââââââââââââââââââââââââ342            âââââââââââââââââââââââââââââ343            âââââââââââââââââââââââââââââ{}'''.format(cores['ciano'], cores['limpa'])344                            print(quadr)345                            print()346                            if self.atributo == 'Sorte':347                                print('[1] - Vasculhar o quadro\n',348                                      '[2] - Admirar o quadro\n',349                                      '[3] -{}Rasgar o quadro{}'.format(cores['red'], cores['limpa']))350                            else:351                                print('[1] - Vasculhar o quadro\n',352                                      '[2] - Admirar o quadro\n',353                                      '[3] - Rasgar o quadro')354                            acaoQuadro = int(input('>> '))355                            if acaoQuadro == 1:356                                fraseAnimation = 'Você não encontrou nada...'357                                self.animation(fraseAnimation)358                                sleep(2)359                                relogio.corretempo(2)360                                clear.clearSystem()361                                clear.clearAll()362                            elif acaoQuadro == 2:363                                fraseAnimation = '''Essa realmente é uma obra muito bonita, entendo você querer adimirá-la364Porem seu {}tempo{} está {}correndo{}'''.format(cores['Mage'], cores['limpa'], cores['amarelo'], cores['limpa'])365                                self.animation(fraseAnimation)366                                sleep(2)367                                relogio.corretempo(5)368                                clear.clearSystem()369                                clear.clearAll()370                            elif acaoQuadro == 3:371                                fraseAnimation = '''Que loucura rasgar um quadro tão lindo quanto esse...372Porem situações desesperadas pedem medidas desesperadas373Você encontrou dentro do quadro uma {}chave pequena{}...\n\n'''.format(cores['Mage'], cores['limpa'])374                                self.animation(fraseAnimation)375                                self.chaveBau = True376                                sleep(2)377                                clear.clearSystem()378                                clear.clearAll()379                        else:380                            print('OK!')381                            relogio.corretempo(2)382                            sleep(2)383                            clear.clearSystem()384                            clear.clearAll()385                elif objetos == 3:386                    print("Você deseja: \n\n",387                          "[1] - Vasculhar o quadro\n",388                          "[2] - Quebrar o quadro\n",389                          "[3] - Admirar o quadro\n",)390                    acaoQuadro = int(input('>> '))391                    if acaoQuadro == 1:392                        relogio.corretempo(4)393                        fraseAnimation = '''O quadro da sala é uma referência a JigSaw!394Ao vasculhar o quadro você encontrou uma bilhete de viagem395O que um bilhete de viagem faria atrás de um quadro?\n\n'''  # Conceito para a próxima versão396                        self.animation(fraseAnimation)397                        bilhete = True398                        print('Você deseja: \n\n',399                              '[1] - Ler o bilhete\n',400                              '[2] - Guardar o bilhete\n',401                              '[3] - Rasgar o bilhete?\n')402                        acaoBilhete = int(input(">> "))403                        if acaoBilhete == 1 and bilhete == True:404                            fraseAnimation = '''Bilhete de onibus:405Valor da passagem: R$5,50406Destino: Praia do sono407O que um bilhete de viagem faria aqui?\n\n'''  # Melhorar pergunta com o atributo inteligencia408                            self.animation(fraseAnimation)409                            relogio.corretempo(2)410                            sleep(2)411                            clear.clearSystem()412                            clear.clearAll()413                        elif acaoBilhete == 2 and bilhete == True:414                            fraseAnimation = 'Ele pode vir a ser útil em outro momento...\n\n'415                            self.animation(fraseAnimation)416                            sleep(2)417                            relogio.corretempo(2)418                            clear.clearSystem()419                            clear.clearAll()420                        elif acaoBilhete == 3 and bilhete == True:421                            fraseAnimation = '''Você nem se interessou em saber o que estava escrito422provavelmente não tem intenção nenhuma de sair daqui\n'''423                            self.animation(fraseAnimation)424                            sleep(2)425                            relogio.corretempo(5)426                            bilhete = False427                            clear.clearSystem()428                            clear.clearAll()429                    elif acaoQuadro == 2:430                        fraseAnimation = '''Você quebrou um belo quadro, sem nem mesmo observar!431Você começa a se sentir cansado e sem forças432Continuar agora sem descansar pode lhe trazer {}consequências{}433Deseja tomar um descanso?[sim/não]\n\n'''.format(cores['Mage'], cores['limpa'])434                        self.animation(fraseAnimation)435                        descanso = input(">> ").upper()436                        if descanso == 'SIM':437                            fraseAnimation = 'Descanse um pouco...'438                            self.animation(fraseAnimation)439                            relogio.corretempo(2)440                            sleep(2)441                            clear.clearSystem()442                            clear.clearAll()443                        else:444                            fraseAnimation = 'A vida é feita de {}escolhas{}...\n\n'.format(445                                cores['red'], cores['limpa'])446                            self.animation(fraseAnimation)447                            relogio.corretempo(10)448                            sleep(2)449                            clear.clearSystem()450                            clear.clearAll()451                    elif acaoQuadro == 3:452                        quadr = '''{}453            âââââââââââââââââââââââââââââ454            âââââââââââââââââââââââââââââ455            âââââââââââââââââââââââââââââ456            âââââââââââââââââââââââââââââ457            âââââââââââââââââââââââââââââ458            âââââââââââââââââââââââââââââ459            âââââââââââââââââââââââââââââ460            âââââââââââââââââââââââââââââ461            âââââââââââââââââââââââââââââ462            âââââââââââââââââââââââââââââ463            âââââââââââââââââââââââââââââ464            âââââââââââââââââââââââââââââ465            âââââââââââââââââââââââââââââ466            âââââââââââââââââââââââââââââ467            âââââââââââââââââââââââââââââ468            âââââââââââââââââââââââââââââ469            âââââââââââââââââââââââââââââ470            âââââââââââââââââââââââââââââ471            âââââââââââââââââââââââââââââ472            âââââââââââââââââââââââââââââ473            âââââââââââââââââââââââââââââ474            âââââââââââââââââââââââââââââ475            âââââââââââââââââââââââââââââ476            âââââââââââââââââââââââââââââ477            âââââââââââââââââââââââââââââ478            âââââââââââââââââââââââââââââ479            âââââââââââââââââââââââââââââ480            âââââââââââââââââââââââââââââ481            âââââââââââââââââââââââââââââ482            âââââââââââââââââââââââââââââ483            âââââââââââââââââââââââââââââ484            âââââââââââââââââââââââââââââ485            âââââââââââââââââââââââââââââ486            âââââââââââââââââââââââââââââ487            âââââââââââââââââââââââââââââ488            âââââââââââââââââââââââââââââ489            âââââââââââââââââââââââââââââ490            âââââââââââââââââââââââââââââ491            âââââââââââââââââââââââââââââ492            âââââââââââââââââââââââââââââ493            âââââââââââââââââââââââââââââ494            âââââââââââââââââââââââââââââ495            âââââââââââââââââââââââââââââ496            âââââââââââââââââââââââââââââ497            âââââââââââââââââââââââââââââ498            âââââââââââââââââââââââââââââ499            âââââââââââââââââââââââââââââ500            âââââââââââââââââââââââââââââ501            âââââââââââââââââââââââââââââ{}\n\n'''.format(cores['verde'], cores['limpa'])502                        print(quadr)503                        print('Uma pequena entrada se abre na lateral do quadro...\n',504                              'Deseja entrar? [sim/não]\n')505                        entrar = input(">> ").upper()506                        relogio.corretempo(2)507                        clear.clearSystem()508                        clear.clearAll()509                        if entrar == 'SIM':510                            fraseAnimation = "Você agora se encontra em uma casa...\n\n"511                            self.animation(fraseAnimation)512                            sleep(2)513                            print(' '*20, end='')514                            print('', '__________________________')515                            print(' '*20, end='')516                            print('|', ' '*24, '|')517                            print(' '*20, end='')518                            print('|', ' '*8, ' CASA ', ' '*8, '|')519                            print(' '*20, end='')520                            print('|__________________________|')521                            print('\n'*2)522                            print()523                            fraseAnimation = '''Seus pais te chamam para uma volta de carro524aparentemente estão indo visitar alguém.525Você entra no carro e todos partem para viagem526porém já na estrada você nota que esqueceu o celular\n\n'''527                            self.animation(fraseAnimation)528                            sleep(2)529                            lembranca = True530                            relogio.corretempo(3)531                            clear.clearSystem()532                            clear.clearAll()533                        else:534                            continue535                elif objetos == 4 and self.chaveBau == True:536                    relogio.corretempo(4)537                    fraseAnimation = '''Abrir o baú com a {}chave{} foi uma ótima escolha, nele se encontra uma foto538Nela se encontra Rodin, ao lado de uma de suas obras mais famosas539Porque alguém guardaria essa foto em um baú?\n\n'''.format(cores['Mage'], cores['limpa'])540                    self.animation(fraseAnimation)541                    foto = True542                elif objetos == 4:543                    print("Você deseja: \n\n",544                          "[1] - Abrir o baú\n",545                          "[2] - Vasculhar o baú\n",546                          "[3] - Não fazer nada\n",)547                    acaoBau = int(input('>> '))548                    self.chaveBau = False549                    if acaoBau == 1 and self.chaveBau == False:550                        relogio.corretempo(2)551                        fraseAnimation = 'Você necessita de uma chave para abri-lo'552                        self.animation(fraseAnimation)553                        sleep(2)554                        clear.clearSystem()555                        clear.clearAll()556                    elif acaoBau == 2:557                        fraseAnimation = 'Você não encontrou nada ao verificar o baú...'558                        self.animation(fraseAnimation)559                        sleep(2)560                        clear.clearSystem()561                        clear.clearAll()562                    elif acaoBau == 2 and self.atributo == 'Sorte':563                        relogio.corretempo(2)564                        fraseAnimation = 'Você não encontrou nada ao verificar o baú...'565                        self.animation(fraseAnimation)566                        sleep(2)567                        clear.clearSystem()568                        clear.clearAll()569                    elif acaoBau == 3:570                        clear.clearSystem()571                        clear.clearAll()572                        continue573                elif objetos == 5 and foto == True:574                    relogio.corretempo(4)575                    print('Que bela estátua, é uma réplica da obra "O Pensador de Agusto Rodin"\n',576                          '[1] - Olhar a estatua\n',577                          '[2] - Girar a estatua\n',578                          '[3] - Não fazer nada')579                    acaoEstatua = int(input(">> "))580                    sleep(2)581                    if acaoEstatua == 2:  # ===============\\ 2° e 3° FINAL //===================582                        fraseAnimation = '''Boa escolha, você girou a estatua com delicadeza583Um buraco se abre no peito da estátua584lhe dando acesso a {}chave{} que abre a porta de saÃda ...\n\n'''.format(cores['red'], cores['limpa'])585                        relogio.corretempo(4)586                        self.chavePorta = True587                        sleep(2)588                        clear.clearSystem()589                        clear.clearAll()590                    else:591                        fraseAnimation = 'Nada de diferente aconteceu, talvez fosse apenas uma {}impressão{} sua...\n\n'.format(592                            cores['ciano'], cores['limpa'])593                        self.animation(fraseAnimation)594                        relogio.corretempo(4)595                        sleep(2)596                        clear.clearSystem()597                        clear.clearAll()598                elif objetos == 5:599                    print("Você deseja: \n\n",600                          "[1] - Admirar a estátua\n",601                          "[2] - Não fazer nada\n",)602                    acaoEstatua = int(input('>> '))603                    if acaoEstatua == 1:604                        relogio.corretempo(4)605                        fraseAnimation = '''Que bela estátua, é uma réplica da obra "O {}Pensador{} de Agusto Rodin.606é uma das mais famosas esculturas de bronze do escultor francês Auguste Rodin.607Retrata um homem em meditação soberba, lutando com uma poderosa força interna.608O Pensador originalmente procurava retratar Dante em frente dos Portões do Inferno609ponderando seu grande poema...\n\n'''.format(cores['amarelo'], cores['limpa'])610                        self.animation(fraseAnimation)611                        sleep(2)612                        clear.clearSystem()613                        clear.clearAll()614                    else:615                        continue616                elif objetos == 6 and machucado == True:617                    deseja = input(618                        'Você deseja abrir a bolsa de remédios? ').lower()619                    if deseja == 'sim':620                        fraseAnimation = '''{}Boa escolha, dentro da bolsa de remédios temos analgésicos e gaze para o seu machucado{}621Pode continuar sem nenhum problema\n\n'''.format(cores['ciano'], cores['limpa'])622                        self.animation(fraseAnimation)623                        relogio.corretempo(2)624                        sleep(2)625                        clear.clearSystem()626                        clear.clearAll()627                    else:628                        fraseAnimation = 'Você está machucado e mesmo assim não quis abrir a bolsa de remédios, isso terá consequências!'629                        self.animation(fraseAnimation)630                        relogio.corretempo(7)631                        sleep(2)632                        clear.clearSystem()633                        clear.clearAll()634                elif objetos == 6 and lembranca == True:635                    print("Você deseja: \n\n",636                          "[1] - Abrir a bolsa\n",637                          "[2] - Jogar a bolsa no lixo\n",638                          "[3] - Não fazer nada\n",)639                    acaoBolsa = int(input('>> '))640                    if acaoBolsa == 1:641                        fraseAnimation = "Você abre a bolsa e encontra o que aparentemente é a {}chave de um baú{}\n\n".format(642                            cores['Mage'], cores['limpa'])643                        self.animation(fraseAnimation)644                        relogio.corretempo(3)645                        self.chaveBau = True646                        sleep(2)647                        clear.clearSystem()648                        clear.clearAll()649                    elif acaoBolsa == 2:650                        print('*Jogando a bolsa no lixo..*')651                    else:652                        continue653                elif objetos == 6:654                    fraseAnimation = '''Uma bolsa de remédios pode ser útil em momentos de necessidade655'Fique atento caso precise de cuidados médicos\n'''656                    self.animation(fraseAnimation)657                    print("Você deseja: \n\n",658                          "[1] - Abrir a bolsa\n",659                          "[2] - Não fazer nada\n",)660                    acaoBolsa = int(input('>> '))661                    if acaoBolsa == 1:662                        relogio.corretempo(2)663                        fraseAnimation = '{}Na bolsa temos analgésicos e gaze para uma eventual necessidade{}\n\n'.format(664                            cores['azul'], cores['limpa'])665                        self.animation(fraseAnimation)666                    else:667                        continue668            elif escolha == 3:669                if self.atributo == 'Força':670                    fraseAnimation = "A porta é de ferro e você esta machucado, dessa vez não poderá contar com sua força!"671                    self.animation(fraseAnimation)672                    relogio.corretempo(2)673                    sleep(2)674                    clear.clearSystem()675                    clear.clearAll()676                else:677                    fraseAnimation = "Você é frac{} demais para isso!".format(678                        self.generos())679                    self.animation(fraseAnimation)680                    relogio.corretempo(2)681                    sleep(2)682                    clear.clearSystem()683                    clear.clearAll()684            if relogio.minutos <= 0:685                pygame.mixer.music.stop()686                musicGameOver = pygame.mixer.Sound('_music/gameo4.ogg')687                musicGameOver.play()688                teste = 0689                while teste < 5:690                    frase = [691                        '''692                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ693                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ694                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ695                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ696                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ697                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ''', '''698                            ââââââââââââââââââââââââââââââââââââ    âââââââââââââââââââââââââââââââââ699                            ââââââââââââââââââââââââââââââââââââ    âââââââââââââââââââââââââââââââââ700                            ââââââââââââââââââââââââââââââââââââ    âââââââââââââââââââââââââââââââââ701                            ââââââââââââââââââââââââââââââââââââ    âââââââââââââââââââââââââââââââââ702                            ââââââââââââââââââââââââââââââââââââ    âââââââââââââââââââââââââââââââââ703                            ââââââââââââââââââââââââââââââââââââ    âââââââââââââââââââââââââââââââââ''']704                    teste += 1705                    for i in frase:706                        for cont in range(1):707                            print(i)708                            sleep(0.5)709                            clear.clearSystem()710                            clear.clearAll()711                            sys.stdout.flush()712                print('''713                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ714                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ715                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ716                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ717                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ718                            âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ''')...scripts.js
Source:scripts.js  
...37    loadDefaultArticles();38    // /***** Self Install Orders - All Types *****/3940    if (id === "ezcCable") {41      clearAll();42      $(selectedItemOutput).html(ezcCable.template);43      $(selectedItemNotes).html(ezcCable.notes);44      $(selectedItemLinks).html(ezcCable.links);4546      setTargetBlank();47    }4849    if (id === "ezcInternet") {50      clearAll();51      $(selectedItemOutput).html(ezcInternet.template);52      $(selectedItemNotes).html(ezcInternet.notes);53      $(selectedItemLinks).html(ezcInternet.links);5455      setTargetBlank();56    }5758    if (id === "ezcPhone") {59      clearAll();60      $(selectedItemOutput).html(ezcPhone.template);61      $(selectedItemNotes).html(ezcPhone.notes);62      $(selectedItemLinks).html(ezcPhone.links);6364      setTargetBlank();65    }6667    if (id === "ezcCableInternet") {68      clearAll();69      $(selectedItemOutput).html(ezcCableInternet.template);70      $(selectedItemNotes).html(ezcCableInternet.notes);71      $(selectedItemLinks).html(ezcCableInternet.links);7273      setTargetBlank();74    }7576    if (id === "ezcCablePhone") {77      clearAll();78      $(selectedItemOutput).html(ezcCablePhone.template);79      $(selectedItemNotes).html(ezcCablePhone.notes);80      $(selectedItemLinks).html(ezcCablePhone.links);8182      setTargetBlank();83    }8485    if (id === "ezcInternetPhone") {86      clearAll();87      $(selectedItemOutput).html(ezcInternetPhone.template);88      $(selectedItemNotes).html(ezcInternetPhone.notes);89      $(selectedItemLinks).html(ezcInternetPhone.links);9091      setTargetBlank();92    }9394    if (id === "ezcCableInternetPhone") {95      clearAll();96      $(selectedItemOutput).html(ezcCableInternetPhone.template);97      $(selectedItemNotes).html(ezcCableInternetPhone.notes);98      $(selectedItemLinks).html(ezcCableInternetPhone.links);99100      setTargetBlank();101    }102103104    if (id === "ezcMailRemote") {105      clearAll();106      $(selectedItemOutput).html(ezcMailRemote.template);107      $(selectedItemNotes).html(ezcMailRemote.notes);108      $(selectedItemLinks).html(ezcMailRemote.links);109110      setTargetBlank();111    }112113    if (id === "ezcEmptyCarton") {114      clearAll();115      $(selectedItemOutput).html(ezcEmptyCarton.template);116      $(selectedItemNotes).html(ezcEmptyCarton.notes);117      $(selectedItemLinks).html(ezcEmptyCarton.links);118119      setTargetBlank();120    }121122    if (id === "ezcLLSwapMailOut") {123      clearAll();124      $(selectedItemOutput).html(ezcLLSwapMailOut.template);125      $(selectedItemNotes).html(ezcLLSwapMailOut.notes);126      $(selectedItemLinks).html(ezcLLSwapMailOut.links);127128      setTargetBlank();129    }130131    if (id === "ezcLLSwapPickUp") {132      clearAll();133      $(selectedItemOutput).html(ezcLLSwapPickUp.template);134      $(selectedItemNotes).html(ezcLLSwapPickUp.notes);135      $(selectedItemLinks).html(ezcLLSwapPickUp.links);136137      setTargetBlank();138    }139140    if (id === "ezcNonCompliantModemSwap") {141      clearAll();142      $(selectedItemOutput).html(ezcNonCompliantModemSwap.template);143      $(selectedItemNotes).html(ezcNonCompliantModemSwap.notes);144      $(selectedItemLinks).html(ezcNonCompliantModemSwap.links);145146      setTargetBlank();147    }148149    if (id === "ezcSIKResearch") {150      clearAll();151      $(selectedItemOutput).html(ezcSIKResearch.template);152      $(selectedItemNotes).html(ezcSIKResearch.notes);153      $(selectedItemLinks).html(ezcSIKResearch.links);154155      setTargetBlank();156    }157158159    /***** Existing Customer Modify Existing LOB or Add LOB *****/160161    if (id === "cosOfficeOnly") {162      clearAll();163      $(selectedItemOutput).html(cosNTrpCable.template);164      $(selectedItemNotes).html(cosNTrpCable.notes);165      $(selectedItemLinks).html(cosNTrpCable.links);166      setTargetBlank();167    }168169    if (id === "cosTechInstall") {170      clearAll();171      $(selectedItemOutput).html(cosTrpCable.template);172      $(selectedItemNotes).html(cosTrpCable.notes);173      $(selectedItemLinks).html(cosTrpCable.links);174      setTargetBlank();175    }176177    if (id === "addNewLOBSelfInstall") {178      clearAll();179      $(selectedItemOutput).html(addNewLOBSelfInstall.template);180      $(selectedItemNotes).html(addNewLOBSelfInstall.notes);181      $(selectedItemLinks).html(addNewLOBSelfInstall.links);182      setTargetBlank();183    }184185    if (id === "addNewLOBCable") {186      clearAll();187      $(selectedItemOutput).html(addNewLOBCable.template);188      $(selectedItemNotes).html(addNewLOBCable.notes);189      $(selectedItemLinks).html(addNewLOBCable.links);190      setTargetBlank();191    }192193    if (id === "addNewLOBInternet") {194      clearAll();195      $(selectedItemOutput).html(addNewLOBInternet.template);196      $(selectedItemNotes).html(addNewLOBInternet.notes);197      $(selectedItemLinks).html(addNewLOBInternet.links);198      setTargetBlank();199    }200201    if (id === "addNewLOBPhone") {202      clearAll();203      $(selectedItemOutput).html(addNewLOBPhone.template);204      $(selectedItemNotes).html(addNewLOBPhone.notes);205      $(selectedItemLinks).html(addNewLOBPhone.links);206      setTargetBlank();207    }208209    if (id === "addNewLOBCableInternet") {210      clearAll();211      $(selectedItemOutput).html(addNewLOBCableInternet.template);212      $(selectedItemNotes).html(addNewLOBCableInternet.notes);213      $(selectedItemLinks).html(addNewLOBCableInternet.links);214      setTargetBlank();215    }216217    if (id === "addNewLOBCablePhone") {218      clearAll();219      $(selectedItemOutput).html(addNewLOBCablePhone.template);220      $(selectedItemNotes).html(addNewLOBCablePhone.notes);221      $(selectedItemLinks).html(addNewLOBCablePhone.links);222      setTargetBlank();223    }224225    if (id === "addNewLOBInternetPhone") {226      clearAll();227      $(selectedItemOutput).html(addNewLOBInternetPhone.template);228      $(selectedItemNotes).html(addNewLOBInternetPhone.notes);229      $(selectedItemLinks).html(addNewLOBInternetPhone.links);230      setTargetBlank();231    }232233234235    /***** Brand New Customer Install *****/236237    if (id === "newLOBCable") {238      clearAll();239      $(selectedItemOutput).html(newLOBCable.template);240      $(selectedItemNotes).html(newLOBCable.notes);241      $(selectedItemLinks).html(newLOBCable.links);242      setTargetBlank();243    }244245    if (id === "newLOBInternet") {246      clearAll();247      $(selectedItemOutput).html(newLOBInternet.template);248      $(selectedItemNotes).html(newLOBInternet.notes);249      $(selectedItemLinks).html(newLOBInternet.links);250      setTargetBlank();251    }252253    if (id === "newLOBPhone") {254      clearAll();255      $(selectedItemOutput).html(newLOBPhone.template);256      $(selectedItemNotes).html(newLOBPhone.notes);257      $(selectedItemLinks).html(newLOBPhone.links);258      setTargetBlank();259    }260261    if (id === "newLOBCableInternet") {262      clearAll();263      $(selectedItemOutput).html(newLOBCableInternet.template);264      $(selectedItemNotes).html(newLOBCableInternet.notes);265      $(selectedItemLinks).html(newLOBCableInternet.links);266      setTargetBlank();267    }268269    if (id === "newLOBCablePhone") {270      clearAll();271      $(selectedItemOutput).html(newLOBCablePhone.template);272      $(selectedItemNotes).html(newLOBCablePhone.notes);273      $(selectedItemLinks).html(newLOBCablePhone.links);274      setTargetBlank();275    }276277    if (id === "newLOBInternetPhone") {278      clearAll();279      $(selectedItemOutput).html(newLOBInternetPhone.template);280      $(selectedItemNotes).html(newLOBInternetPhone.notes);281      $(selectedItemLinks).html(newLOBInternetPhone.links);282      setTargetBlank();283    }284285    if (id === "newLOBCableInternetPhone") {286      clearAll();287      $(selectedItemOutput).html(newLOBCableInternetPhone.template);288      $(selectedItemNotes).html(newLOBCableInternetPhone.notes);289      $(selectedItemLinks).html(newLOBCableInternetPhone.links);290      setTargetBlank();291    }292293    if (id === "officeOnlyCOS") {294      clearAll();295      $(selectedItemOutput).html(cosOfficeOnly.template);296      $(selectedItemNotes).html(cosOfficeOnly.notes);297      $(selectedItemLinks).html(cosOfficeOnly.links);298      setTargetBlank();299    }300301    if (id === "tnFeatureChange") {302      clearAll();303      $(selectedItemOutput).html(tnFeatureChange.template);304      $(selectedItemNotes).html(tnFeatureChange.notes);305      $(selectedItemLinks).html(tnFeatureChange.links);306      setTargetBlank();307    }308309    /***** Transfer of Service - Self Install *****/310311    if (id === "transferOfService") {312      clearAll();313      $(selectedItemOutput).html(transferOfService.template);314      $(selectedItemNotes).html(transferOfService.notes);315      $(selectedItemLinks).html(transferOfService.links);316      setTargetBlank();317    }318319    if (id === "tosCableEZC") {320      clearAll();321      $(selectedItemOutput).html(tosCableEZC.template);322      $(selectedItemNotes).html(tosCableEZC.notes);323      $(selectedItemLinks).html(tosCableEZC.links);324      setTargetBlank();325    }326327    if (id === "tosInternetEZC") {328      clearAll();329      $(selectedItemOutput).html(tosInternetEZC.template);330      $(selectedItemNotes).html(tosInternetEZC.notes);331      $(selectedItemLinks).html(tosInternetEZC.links);332      setTargetBlank();333    }334335    if (id === "tosPhoneEZC") {336      clearAll();337      $(selectedItemOutput).html(tosPhoneEZC.template);338      $(selectedItemNotes).html(tosPhoneEZC.notes);339      $(selectedItemLinks).html(tosPhoneEZC.links);340      setTargetBlank();341    }342343    if (id === "tosCableInternetEZC") {344      clearAll();345      $(selectedItemOutput).html(tosCableInternetEZC.template);346      $(selectedItemNotes).html(tosCableInternetEZC.notes);347      $(selectedItemLinks).html(tosCableInternetEZC.links);348      setTargetBlank();349    }350351    if (id === "tosCablePhoneEZC") {352      clearAll();353      $(selectedItemOutput).html(tosCablePhoneEZC.template);354      $(selectedItemNotes).html(tosCablePhoneEZC.notes);355      $(selectedItemLinks).html(tosCablePhoneEZC.links);356      setTargetBlank();357    }358359    if (id === "tosInternetPhoneEZC") {360      clearAll();361      $(selectedItemOutput).html(tosInternetPhoneEZC.template);362      $(selectedItemNotes).html(tosInternetPhoneEZC.notes);363      $(selectedItemLinks).html(tosInternetPhoneEZC.links);364      setTargetBlank();365    }366367    if (id === "tosCableInternetPhoneEZC") {368      clearAll();369      $(selectedItemOutput).html(tosCableInternetPhoneEZC.template);370      $(selectedItemNotes).html(tosCableInternetPhoneEZC.notes);371      $(selectedItemLinks).html(tosCableInternetPhoneEZC.links);372      setTargetBlank();373    }374375    if (id === "tosCableTech") {376      clearAll();377      $(selectedItemOutput).html(tosCableTech.template);378      $(selectedItemNotes).html(tosCableTech.notes);379      $(selectedItemLinks).html(tosCableTech.links);380      setTargetBlank();381    }382383    if (id === "tosInternetTech") {384      clearAll();385      $(selectedItemOutput).html(tosInternetTech.template);386      $(selectedItemNotes).html(tosInternetTech.notes);387      $(selectedItemLinks).html(tosInternetTech.links);388      setTargetBlank();389    }390391    if (id === "tosPhoneTech") {392      clearAll();393      $(selectedItemOutput).html(tosPhoneTech.template);394      $(selectedItemNotes).html(tosPhoneTech.notes);395      $(selectedItemLinks).html(tosPhoneTech.links);396      setTargetBlank();397    }398399    if (id === "tosCableInternetTech") {400      clearAll();401      $(selectedItemOutput).html(tosCableInternetTech.template);402      $(selectedItemNotes).html(tosCableInternetTech.notes);403      $(selectedItemLinks).html(tosCableInternetTech.links);404      setTargetBlank();405    }406407    if (id === "tosCablePhoneTech") {408      clearAll();409      $(selectedItemOutput).html(tosCablePhoneTech.template);410      $(selectedItemNotes).html(tosCablePhoneTech.notes);411      $(selectedItemLinks).html(tosCablePhoneTech.links);412      setTargetBlank();413    }414415    if (id === "tosInternetPhoneTech") {416      clearAll();417      $(selectedItemOutput).html(tosInternetPhoneTech.template);418      $(selectedItemNotes).html(tosInternetPhoneTech.notes);419      $(selectedItemLinks).html(tosInternetPhoneTech.links);420      setTargetBlank();421    }422423    if (id === "tosCableInternetPhoneTech") {424      clearAll();425      $(selectedItemOutput).html(tosCableInternetPhoneTech.template);426      $(selectedItemNotes).html(tosCableInternetPhoneTech.notes);427      $(selectedItemLinks).html(tosCableInternetPhoneTech.links);428      setTargetBlank();429    }430431432    /***** Other / Misc *****/433434    if (id === "officeOnlyCOS") {435      clearAll();436      $(selectedItemOutput).html(cosNTrpCable.template);437      $(selectedItemNotes).html(cosNTrpCable.notes);438      $(selectedItemLinks).html(cosNTrpCable.links);439      setTargetBlank();440    }441442    if (id === "tnFeatureChange") {443      clearAll();444      $(selectedItemOutput).html(tnFeatureChange.template);445      $(selectedItemNotes).html(tnFeatureChange.notes);446      $(selectedItemLinks).html(tnFeatureChange.links);447      setTargetBlank();448    }449450    if (id === "wallfish") {451      clearAll();452      $(selectedItemOutput).html(wallfish.template);453      $(selectedItemNotes).html(wallfish.notes);454      $(selectedItemLinks).html(wallfish.links);455      setTargetBlank();456    }457458459    /***** SRO / Down Drops *****/460461    if (id === "generalSROCodes") {462      clearAll();463      $(selectedItemOutput).html(generalSROCodes.template);464      $(selectedItemNotes).html(generalSROCodes.notes);465      $(selectedItemLinks).html(generalSROCodes.links);466      setTargetBlank();467    }468469    if (id === "downDropProcess") {470      clearAll();471      $(selectedItemOutput).html(downDropProcess.template);472      $(selectedItemNotes).html(downDropProcess.notes);473      $(selectedItemLinks).html(downDropProcess.links);474      setTargetBlank();475    }476477    if (id === "equipmentPickUp") {478      clearAll();479      $(selectedItemOutput).html(equipmentPickUp.template);480      $(selectedItemNotes).html(equipmentPickUp.notes);481      $(selectedItemLinks).html(equipmentPickUp.links);482      setTargetBlank();483    }484485    if (id === "signalLeakage") {486      clearAll();487      $(selectedItemOutput).html(signalLeakage.template);488      $(selectedItemNotes).html(signalLeakage.notes);489      $(selectedItemLinks).html(signalLeakage.links);490      setTargetBlank();491    }492493    if (id === "billingRegions") {494      clearAll();495      $(selectedItemOutput).html(billingRegions.template);496      $(selectedItemNotes).html(billingRegions.notes);497      $(selectedItemLinks).html(billingRegions.links);498      setTargetBlank();499    }500501    // if (id === "otcsVSServiceCodes") {502    //   clearAll();503    //   $(selectedItemOutput).html(otcsVSServiceCodes.template);504    //   $(selectedItemNotes).html(otcsVSServiceCodes.notes);505    //   $(selectedItemLinks).html(otcsVSServiceCodes.links);506    //   setTargetBlank();507    // }508509510511    /***** Toggles the inline note *****/512    // The inline note must be a sibling of the div marked 'has-inline-note' for this to work513514    $(hasInlineNote).on("click", function () {515      $(this).nextAll(inlineNote).eq(0).slideToggle("hide");516    });517518    $(inlineNote).on("click", function () {519      $(this).slideToggle("hide");520    });521  });522523524  /***** Clears all fields to start fresh *****/525526  function clearAll() {527    selectedItemOutput.innerHTML = "...";528    selectedItemNotes.innerHTML = "";529    selectedItemLinks.innerHTML = "";530  }531532533  /***** Reset clears the selections in the 'You have selected' area *****/534535  $("#reset").on("click", function () {536    selectedItemOutput.innerHTML = "...";537    selectedItemNotes.innerHTML = "";538    selectedItemLinks.innerHTML = "";539    defaultLinksDiv.innerHTML = "";540    defaultTechOTCArticlesDiv.innerHTML = "";
...unittests.py
Source:unittests.py  
1import unittest2import data_store3ds = data_store.data_store()4567class TestCalc(unittest.TestCase):89    def test_Key_type(self):10        with self.assertRaises(Exception):11            ds.ClearAll()12            ds.CheckKey(None)13        with self.assertRaises(Exception):14            ds.ClearAll()15            ds.CheckKey(3)16        with self.assertRaises(Exception):17            ds.ClearAll()18            ds.CheckKey(1.2)19        with self.assertRaises(Exception):20            ds.ClearAll()21            ds.CheckKey(True)22        23    def test_Value_type(self):24        with self.assertRaises(Exception):25            ds.ClearAll()26            ds.CheckValue(None)27        with self.assertRaises(Exception):28            ds.ClearAll()29            ds.CheckValue(3)30        with self.assertRaises(Exception):31            ds.ClearAll()32            ds.CheckValue(1.2)33        with self.assertRaises(Exception):34            ds.ClearAll()35            ds.CheckValue(True)36        with self.assertRaises(Exception):37            ds.ClearAll()38            ds.CheckValue('string')3940    def test_Value_size(self):41        with self.assertRaises(Exception):42            ds.ClearAll()43            limit = 1024 * 2 # 1024*2*8 +10 > 16KB44            value = '{'45            for i in range(limit):46                value = value + '"Age' + str(i) + '":2,'47            value = value + '"Roll": 3}'48            ds.Create('key', value)49        50        try:51            ds.ClearAll()52            limit = 1024 # 1024*8 =  8KB53            value = '{'54            for i in range(limit):55                value = value + '"Age' + str(i) + '":2,'56            value = value + '"Roll": 3}'57            ds.Create('key', value)58        except :59            self.fail()60        61    def test_Key_size(self):62        with self.assertRaises(Exception):63            ds.ClearAll()64            key = 'a'*3365            ds.Create(key, '{"Age":2}')66        67        try:68            ds.ClearAll()69            key = 'a'*3270            ds.Create(key, '{"Age":2}')71        except :72            self.fail()73        74    def test_ttl_type(self):75        with self.assertRaises(Exception):76            ds.ClearAll()77            ds.Create('key', '{"Age":2}', True)78        79        with self.assertRaises(Exception):80            ds.ClearAll()81            ds.Create('key', '{"Age":2}', 'string')82        83    def test_ttl_value(self):84        with self.assertRaises(Exception):85            ds.ClearAll()86            ds.Create('key', '{"Age":2}', -3)8788    def test_Create_type(self):89        with self.assertRaises(Exception):90            ds.ClearAll()91            ds.Create(None)92        with self.assertRaises(Exception):93            ds.ClearAll()94            ds.Create({'a':1})95        with self.assertRaises(Exception):96            ds.ClearAll()97            ds.Create(None, 3)98        with self.assertRaises(Exception):99            ds.ClearAll()100            ds.Create(None, 1.2)101        with self.assertRaises(Exception):102            ds.ClearAll()103            ds.Create(None, True)104        with self.assertRaises(Exception):105            ds.ClearAll()106            ds.Create(3)107        with self.assertRaises(Exception):108            ds.ClearAll()109            ds.Create(1.2)110        with self.assertRaises(Exception):111            ds.ClearAll()112            ds.Create(True)113        with self.assertRaises(Exception):114            ds.ClearAll()115            ds.Create('key', 3)116        with self.assertRaises(Exception):117            ds.ClearAll()118            ds.Create('key', 1.2)119        with self.assertRaises(Exception):120            ds.ClearAll()121            ds.Create('key', True)122        with self.assertRaises(Exception):123            ds.ClearAll()124            ds.Create('key', '{"Age":2}', 'string')125        with self.assertRaises(Exception):126            ds.ClearAll()127            ds.Create('key', '{"Age":2}', False)128        with self.assertRaises(Exception):129            ds.ClearAll()130            ds.Create('key', '{"Age":2}', -3)131132    def test_Create_size(self):133        with self.assertRaises(Exception):134            ds.ClearAll()135            limit = 1024 * 2 # 1024*2*8 + 10 > 16KB136            value = '{'137            for i in range(limit):138                value = value + '"Age' + str(i) + '":2,'139            value = value + '"Roll": 3}'140            ds.Create('key', value)141        142        try:143            ds.ClearAll()144            limit = 1024 # 1024*8 =  8KB145            value = '{'146            for i in range(limit):147                value = value + '"Age' + str(i) + '":2,'148            value = value + '"Roll": 3}'149            ds.Create('key', value)150        except :151            self.fail()152        153        with self.assertRaises(Exception):154            ds.ClearAll()155            key = 'a'*33156            ds.Create(key, '{"Age":2, "Roll":3}')157        158        try:159            ds.ClearAll()160            key = 'a'*32161            ds.Create(key, '{"Age":2, "Roll":3}')162        except :163            self.fail()164        165    166    def test_Read(self):167        with self.assertRaises(Exception):168            ds.Read(None)169        with self.assertRaises(Exception):170            ds.Read(3)171        with self.assertRaises(Exception):172            ds.Read(True)173        with self.assertRaises(Exception):174            ds.Read({'a':1})175        try:176            ds.ClearAll()177            ds.Create('key', '{"Age":2, "Roll":3}')178            ds.Read('key')179        except :180            self.fail()181182    def test_Delete(self):183        with self.assertRaises(Exception):184            ds.Delete(None)185        with self.assertRaises(Exception):186            ds.Delete(3)187        with self.assertRaises(Exception):188            ds.Delete(True)189        with self.assertRaises(Exception):190            ds.Delete({'a':1})191        192        193        194195if __name__ == '__main__':196    unittest.main()
...Changetime.py
Source:Changetime.py  
1#Changetime to make up for lack of RTC2from PitftGraphicLib import *3initdis()4#Time Date check5from time import sleep6import datetime7import os8switch = 09back = 010modtime = ''11def layout(what,info):12     make_label(info, 175, 30, 24, yellow)13     make_label('Set '+what, 20, 20, 47, cyan) #'10:30 am'14     def exit(): 15       clearall()16       global back17       back = 118     def change():19       global switch20       switch = 121     def input(insert): 22       global modtime23       modtime = modtime+insert24       clearall()25       layout(what,info)26     def de():27      global modtime28      modtime = modtime[:len(modtime)-1]29      clearall()30      layout(what,info)31     def one(): input('1')32     def two(): input('2')33     def three(): input('3')34     def four(): input('4')35     def five(): input('5')36     def six(): input('6')37     def seven(): input('7')38     def eight(): input('8')39     def nine(): input('9')40     def zero(): input('0')41     make_button(modtime, 40, 70, 40, 166, 5, green, 40, exit)42     make_button('1', 40, 120, 35, 35, 5, cyan, 40, one)43     make_button('2', 103, 120, 35, 35, 5, cyan, 40, two)44     make_button('3', 166, 120, 35, 35, 5, cyan, 40, three)45     make_button('4', 40, 173, 35, 35, 5, cyan, 40, four)46     make_button('5', 103, 173, 35, 35, 5, cyan, 40, five)47     make_button('6', 166, 173, 35, 35, 5, cyan, 40, six)48     make_button('7', 40, 221, 35, 35, 5, cyan, 40, seven)49     make_button('8', 103, 221, 35, 35, 5, cyan, 40, eight)50     make_button('9', 166, 221, 35, 35, 5, cyan, 40, nine)51     make_button('Switch', 40, 269, 35, 35, 5, green, 15, change)52     make_button('0', 103, 269, 35, 35, 5, cyan, 40, zero)53     make_button('Del', 166, 269, 35, 35, 5, green, 25, de)54def no():55  clearall()56  make_label('NO!', 20, 20, 94, green)57  touchdisch()58  sleep(1)59  clearall()60def show():61  clearall()62  #Time and date 63  #global time64  time = datetime.datetime.now().time()65  make_label(str(time)[0:8], 20, 20, 47, cyan) #'10:30 am'66  date = datetime.date.today()67  make_label(date, 20, 55, 32, green) #'16/5/2015'68  touchdisch()69  sleep(5)70  clearall()71def date():72  global switch73  global back74  global modtime75  layout('Date','dd')76  while True:77    touchdisch()78    if switch == 1: break79    if back == 1:80      back = 081      if len(modtime) == 2: break82      else: 83        no()84        layout('Date','dd')85  date = modtime86  modtime = ''87  clearall()88  ###################################89  layout('Month','mm')90  while True:91    touchdisch()92    if switch == 1: break93    if back == 1:94      back = 095      if len(modtime) == 2: break96      else: 97        no()98        layout('Month','mm')99  month = modtime100  modtime = ''101  clearall()102  ###################################103  layout('Year','yyyy')104  while True:105    touchdisch()106    if switch == 1: break107    if back == 1:108      back = 0109      if len(modtime) == 4: break110      else: 111        no()112        layout('Year','yyyy')113  year = modtime114  modtime = ''115  clearall()116  if len(date) != 2: pass117  elif len(month) != 2: pass118  elif len(year) != 4: pass119  elif switch == 1: pass120  else: os.system('sudo date +%Y%m%d -s "'+year+month+date+'"')121  switch = 0122def chtime():123  global switch124  global back125  global modtime126  layout('Time','h:m:s')127  while True:128    touchdisch()129    if len(modtime) == 2:130      if prev > len(modtime):131        modtime = modtime[0]132        clearall()133        layout('Time','h:m:s') 134      else:135        modtime = modtime+':'136        clearall()137        layout('Time','h:m:s')138    if len(modtime) == 5:139      if prev > len(modtime):140        modtime = modtime[0:4]141        clearall()142        layout('Time','h:m:s') 143      else:144        modtime = modtime+':'145        clearall()146        layout('Time','h:m:s')147    prev = len(modtime)148    if switch == 1: break149    if back == 1:150      back = 0151      if len(modtime) == 8: break152      else: 153        no()154        layout('Time','h:m:s')155  time = modtime156  modtime = ''157  clearall()158  ###################################159  if len(time) != 8: pass160  elif switch == 1: pass161  else: os.system('sudo date +%T -s "'+time+'"')162  switch = 0163while True:164  chtime()165  show()166  date()...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!!
