How to use control_set method in autotest

Best Python code snippet using autotest_python

tests.py

Source:tests.py Github

copy

Full Screen

1import unittest2from index import Metagrapher3class LangSpecificTests(unittest.TestCase):4 def test_DeEn_Transliteration(self):5 mg = Metagrapher()6 testing_set = [7 '',8 '',9 '',10 '',11 '',12 '',13 '',14 '',15 ]16 control_set = [17 '',18 '',19 '',20 '',21 '',22 '',23 '',24 '',25 ]26 resulting_set = [mg.de_en(item).string for item in testing_set]27 self.assertEqual( control_set, resulting_set )28 def test_ArEn_Transliteration(self):29 pass30 def test_AzEn_Transliteration(self):31 mg = Metagrapher()32 testing_set = [33 'abcçdeəfgğƣhxıьijkqlmnoöɵprsştuüvyz',34 'ABCÇDEƏFGĞƢHXIЬIJKQLMNOÖƟPRSŞTUÜVYZ',35 'AbCçDeƏfGğƢhXıЬiJkQlMnOöƟpRsŞtUüVyZ',36 'aBcÇdEəFgĞƣHxIьIjKqLmNoÖɵPrSşTuÜvYz',37 'Ağıllı düşmən nadan dostdan yaxşıdır',38 'Ot kökü üstə bitər',39 'Yetənə yetir, yetməyənə bir daş atır',40 'Tazıya tut deyir, dovşana qaç',41 ]42 control_set = [43 'abccdeafggghxyyizhkqlmnoooprsshtuuvdjz',44 'ABCCDEAFGGGHXIYIZHKQLMNOOOPRSSHTUUVDJZ',45 'AbCcDeAfGgGhXyYiZhkQlMnOoOpRsShtUuVdjZ',46 'aBcCdEaFgGgHxIyIzhKqLmNoOoPrSshTuUvDjz',47 'Agylly dushman nadan dostdan djaxshydyr',48 'Ot koku usta bitar',49 'Djetana djetir, djetmadjana bir dash atyr',50 'Tazydja tut dedjir, dovshana qac',51 ]52 resulting_set = [mg.az_en(item).string for item in testing_set]53 self.assertEqual( control_set, resulting_set )54 def test_BrEn_Transliteration(self):55 pass56 def test_CzEn_Transliteration(self):57 mg = Metagrapher()58 testing_set = [59 'aábcčdďeéěfghchiíjklmnňoópqrřsštťuúůvwxyýzž',60 'AÁBCČDĎEÉĚFGHCHIÍJKLMNŇOÓPQRŘSŠTŤUÚŮVWXYÝZŽ',61 'AáBcČdĎeÉěFgHcHiÍjKlMnŇoÓpQrŘsŠtŤuÚůVwXyÝzŽ',62 'aÁbCčDďEéĚfGhChIíJkLmNňOóPqRřSšTťUúŮvWxYýZž',63 'Ber rád, když dávají',64 'S chutí do toho a půl je hotovo',65 'Strpení přináší spasení',66 'Vlas má svůj stín',67 ]68 control_set = [69 'aabcchddeeefghhiijklmnnoopqrrsshttuuuvwxyizzh',70 'AABCCHDDEEEFGHHIIJKLMNNOOPQRRSSHTTUUUVWXYIZZH',71 'AaBcChdDeEeFgHhiIjKlMnNoOpQrRsShtTuUuVwXyIzZH',72 'aAbCchDdEeEfGhHIiJkLmNnOoPqRrSshTtUuUvWxYiZzh',73 'Ber rad, kdyzh davaji',74 'S huti do toho a pul je hotovo',75 'Strpeni prinashi spaseni',76 'Vlas ma svuj stin',77 ]78 resulting_set = [mg.cz_en(item).string for item in testing_set]79 self.assertEqual( control_set, resulting_set )80 def test_DeEn_Transliteration(self):81 mg = Metagrapher()82 testing_set = [83 'aäbcdefghijklmnoöpqrstuüvwxyzß',84 'AÄBCDEFGHIJKLMNOÖPQRSTUÜVWXYZ',85 'aÄbCdEfGhIjKlMnOöPqRsTuÜvWxYz',86 'AäBcDeFgHiJkLmNoÖpQrStUüVwXyZß',87 'Auf einen großen Klotz gehört ein großer Keil',88 'Das Weib ist des Mannes größtes Glück oder Unglück',89 'Die Arznei ist oft ärger als das Übel',90 'Mancher küßt die Hand, die er abbhauen möchte',91 ]92 control_set = [93 'aabcdefghijklmnoopqrstuuvwxyzss',94 'AABCDEFGHIJKLMNOOPQRSTUUVWXYZ',95 'aAbCdEfGhIjKlMnOoPqRsTuUvWxYz',96 'AaBcDeFgHiJkLmNoOpQrStUuVwXyZss',97 'Auf einen grossen Klotz gehort ein grosser Keil',98 'Das Weib ist des Mannes grosstes Gluck oder Ungluck',99 'Die Arznei ist oft arger als das Ubel',100 'Mancher kusst die Hand, die er abbhauen mochte',101 ]102 resulting_set = [mg.de_en(item).string for item in testing_set]103 self.assertEqual( control_set, resulting_set )104 def test_DvEn_Transliteration(self):105 mg = Metagrapher()106 testing_set = [107 'ހށނރބޅކއވމފދތލގޏސޑޒޓޔޕޖޗ',108 'ަާިީުޫެޭޮޯް',109 'ހުރިހާ އިންސާނުން ވެސް އުފަންވަނީ، ދަރަޖަ',110 'އާއި ޙައްޤު ތަކުގައި މިނިވަންކަމާއި ހަމަހަމަކަން',111 'ލިބިގެންވާ ބައެއްގެ ގޮތުގައެވެ. އެމީހުންނަށް ހެޔޮ',112 'ވިސްނުމާއި ހެޔޮ ބުއްދީގެ ބާރު ލިބިގެން ވެއެވެ',113 ]114 control_set = [115 'hshnrblhkavmfdhthlggnsdztypjch',116 'aaaieeuooeeyooa',117 'hurihaa ainsaanun ves aufanvanee، dharaja',118 'aaaai hhaaqu thakugaai minivankamaaai hamahamakan',119 'libigenvaa baaeage gothugaaeve. aemeehunnash heyo',120 'visnumaaai heyo buadheege baaru libigen veaeve',121 ]122 resulting_set = [mg.dv_en(item).string for item in testing_set]123 self.assertEqual( control_set, resulting_set )124 def test_ElEn_Transliteration(self):125 mg = Metagrapher()126 testing_set = [127 'αβγδεζηθικλlμνξοπρστυφχψωάέίόύήώςϊΰϋΐ',128 'ΑΒΓΔΕΖΗΘΙΚΛLΜΝΞΟΠΡΣΤΥΦΧΨΩΆΈΊΌΎΉΏΣΪΰΫΐ',129 'αΒγΔεΖηΘιΚλLμΝξΟπΡσΤυΦχΨωΆέΊόΎήΏςΪΰΫΐ',130 'ΑβΓδΕζΗθΙκΛlΜνΞοΠρΣτΥφΧψΩάΈίΌύΉώΣϊΰϋΐ',131 'Τα μαγειρεμένα κρεμμύδια, χωρίς τη σάλτσα τους, μπορούν να προστεθούν σε ομελέτες',132 'Η γλώσσα κόκαλα δεν έχει, αλλά κόκαλα τσακίζει',133 'Τα μεγάλα πνεύματα συναντώνται',134 ]135 control_set = [136 'avgdezithikllmnksoprstyfxpsoaeioyiosiyyi',137 'AVGDEZITHIKLLMNKSOPRSTYFXPSOAEIOYIOSIyYi',138 'aVgDeZiThiKlLmNksOpRsTyFxPsoAeIoYiOsIyYi',139 'AvGdEzIthIkLlMnKsoPrStYfXpsOaEiOyIoSiyyi',140 'Ta mageiremena kremmydia, xoris ti saltsa toys, mporoyn na prostethoyn se omeletes',141 'I glossa kokala den exei, alla kokala tsakizei',142 'Ta megala pneymata synantontai',143 ]144 resulting_set = [mg.el_en(item).string for item in testing_set]145 self.assertEqual( control_set, resulting_set )146 def test_EnRu_Transliteration(self):147 mg = Metagrapher()148 testing_set = [149 'abcdefghijklmnopqrstuvwxyz',150 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',151 'AbCdEfGhIjKlMnOpQrStUvWxYz',152 'aBcDeFgHiJkLmNoPqRsTuVwXyZ',153 'pischa dlya uma PISCHA DLYA UMA',154 'zhit` schastlivo i ne tuzhit`',155 'Yuliya Checherina yulya checherina',156 'No man is an island',157 'Hope for the best, but prepare for the worst',158 'Keep your friends close and your enemies closer',159 ]160 control_set = [161 'абкдефгхиджклмнопкрстуввксйз',162 'АБКДЕФГХИДЖКЛМНОПКРСТУВВКСЙЗ',163 'АбКдЕфГхИджКлМнОпКрСтУвВксЙз',164 'аБкДеФгХиДжкЛмНоПкРсТуВвКсйЗ',165 'пища для ума ПИЩА ДЛЯ УМА',166 'жить щастливо и не тужить',167 'Юлия Чечерина юля чечерина',168 'Но ман ис ан исланд',169 'Хопе фор зе бест, бут препаре фор зе ворст',170 'Кип ёур фриендс клосе анд ёур енемиес клосер',171 ]172 resulting_set = [mg.en_ru(item).string for item in testing_set]173 self.assertEqual( control_set, resulting_set )174 def test_FiEn_Transliteration(self):175 mg = Metagrapher()176 testing_set = [177 'abcdefghijklmnopqrstuvwxyzåäöžš',178 'ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖŽŠ',179 'aBcDeFgHiJkLmNoPqRsTuVwXyZåÄöŽš',180 'AbCdEfGhIjKlMnOpQrStUvWxYzÅäÖžŠ',181 'Ei pidä tehdä kärpäsestä härkää',182 'Joka menneitä muistelee, sitä tikulla silmään',183 'On vähäkin tyhjää parempi',184 'Sitä niittää mitä kylvää',185 ]186 control_set = [187 'abcdefghijklmnopqrstuvwxyzaaozhsh',188 'ABCDEFGHIJKLMNOPQRSTUVWXYZAAOZHSH',189 'aBcDeFgHiJkLmNoPqRsTuVwXyZaAoZhsh',190 'AbCdEfGhIjKlMnOpQrStUvWxYzAaOzhSH',191 'Ei pida tehda karpasesta harkaa',192 'Joka menneita muistelee, sita tikulla silmaan',193 'On vahakin tyhjaa parempi',194 'Sita niittaa mita kylvaa',195 ]196 resulting_set = [mg.fi_en(item).string for item in testing_set]197 self.assertEqual( control_set, resulting_set )198 def test_FrEn_Transliteration(self):199 mg = Metagrapher()200 testing_set = [201 'aàâæbcçdeéèêëfghiîïjklmnoôœpqrstuùûüvwxyÿz',202 'AÀÂÆBCÇDEÉÈÊËFGHIÎÏJKLMNOÔŒPQRSTUÙÛÜVWXYŸZ',203 'aÀâÆbCçDeÉèÊëFgHiÎïJkLmNoÔœPqRsTuÙûÜvWxYÿZ',204 'AàÂæBcÇdEéÈêËfGhIîÏjKlMnOôŒpQrStUùÛüVwXyŸz',205 'À qui il a été beaucoup donné, il sera beaucoup demandé',206 'A qui la tête fait mal, souffre par tout le corps',207 'Ce qui croît soudain, périt le lendemain',208 ]209 control_set = [210 'aaaaebcsdeeeeefghiiijklmnoooepqrstuuuuvwxyyz',211 'AAAAEBCSDEEEEEFGHIIIJKLMNOOOEPQRSTUUUUVWXYYZ',212 'aAaAebCsDeEeEeFgHiIiJkLmNoOoePqRsTuUuUvWxYyZ',213 'AaAaeBcSdEeEeEfGhIiIjKlMnOoOepQrStUuUuVwXyYz',214 'A qui il a ete beaucoup donne, il sera beaucoup demande',215 'A qui la tete fait mal, souffre par tout le corps',216 'Ce qui croit soudain, perit le lendemain',217 ]218 resulting_set = [mg.fr_en(item).string for item in testing_set]219 self.assertEqual( control_set, resulting_set )220 def test_HyEn_Transliterateion(self):221 mg = Metagrapher()222 testing_set = [223 'աբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքևօֆ',224 'ԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉՊՋՌՍՎՏՐՑՒՓՔևՕՖ',225 'աԲգԴեԶէԸթԺիԼխԾկՀձՂճՄյՆշՈչՊջՌսՎտՐցՒփՔևՕֆ',226 'ԱբԳդԵզԷըԹժԻլԽծԿհՁղՃմՅնՇոՉպՋռՍվՏրՑւՓքևօՖ',227 'Արևն ամպի տակ չի մնայ',228 'Խնձորը ծառից հեռու չի ընկնում',229 'Կարմիր կովը կաշին չի փոխի',230 'Ուշ լինի, (ա)նուշ լինի',231 ]232 control_set = [233 'abgdezeetzhilkhtskhjltshmynshoсhpjrsvtrtsuphkhevof',234 'ABGDEZEETZHILKHTSKHJLTSHMYNSHOСHPJRSVTRTSUPHKhevOF',235 'aBgDeZeEtZhiLkhTskHjLtshMyNshOсhPjRsVtRtsUphKhevOf',236 'AbGdEzEeTzhIlKhtsKhJlTshmYnShoСhpJrSvTrTsuPhkhevoF',237 'Arevn ampi tak сhi mnay',238 'Khnjore tsarits herou сhi enknoum',239 'Karmir kove kashin сhi phokhi',240 'Oush lini, (a)noush lini',241 ]242 resulting_set = [mg.hy_en(item).string for item in testing_set]243 self.assertEqual( control_set, resulting_set )244 def test_HuEn_Transliteration(self):245 mg = Metagrapher()246 testing_set = [247 'aáäbcdeéëfghiíjklmnoóöőpqrsztuúüűvwxyz',248 'AÁÄBCDEÉËFGHIÍJKLMNOÓÖŐPQRSZTUÚÜŰVWXYZ',249 'aÁäBcDeÉëFgHiÍjKlMnOóÖőPqRsZtUúÜűVwXyZ',250 'AáÄbCdEéËfGhIíJkLmNoÓöŐpQrSzTuÚüŰvWxYz',251 'Addig nyújtózkodj, amíg a takaród ér',252 'A fösvény anélkül is szűkölködik, amije van, anélkül is, amije nincs',253 'Ajándék lónak ne nézd a fogát|Ajándék lónak ne nézd a fogát',254 'Ne fesd az ördögöt a falra',255 ]256 control_set = [257 'aaabcdeeefghiijklmnoooopqrsztuuuuvwxyz',258 'AAABCDEEEFGHIIJKLMNOOOOPQRSZTUUUUVWXYZ',259 'aAaBcDeEeFgHiIjKlMnOoOoPqRsZtUuUuVwXyZ',260 'AaAbCdEeEfGhIiJkLmNoOoOpQrSzTuUuUvWxYz',261 'Addig nyujtozkodj, amig a takarod er',262 'A fosveny anelkul is szukolkodik, amije van, anelkul is, amije nincs',263 'Ajandek lonak ne nezd a fogat|Ajandek lonak ne nezd a fogat',264 'Ne fesd az ordogot a falra',265 ]266 resulting_set = [mg.hu_en(item).string for item in testing_set]267 self.assertEqual( control_set, resulting_set )268 def test_LaEn_Transliteration(self):269 mg = Metagrapher()270 testing_set = [271 'abcdefghiklmnopqrstvxyz𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌉𐌋𐌌𐌍𐌑𐌏𐌈𐌎𐌐𐌒𐌓𐌔𐌖𐌗𐌘𐌙𐌚𐌞𐌡𐌜𐌢𐌝',272 'ABCDEFGHIKLMNOPQRSTVXYZ𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌉𐌋𐌌𐌍𐌑𐌏𐌈𐌎𐌐𐌒𐌓𐌔𐌖𐌗𐌘𐌙𐌚𐌞𐌡𐌜𐌢𐌝',273 'aBcDeFgHiKlMnOpQrStVxYz𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌉𐌋𐌌𐌍𐌑𐌏𐌈𐌎𐌐𐌒𐌓𐌔𐌖𐌗𐌘𐌙𐌚𐌞𐌡𐌜𐌢𐌝',274 'AbCdEfGhIkLmNoPqRsTvXyZ𐌀𐌁𐌂𐌃𐌄𐌅𐌆𐌇𐌉𐌋𐌌𐌍𐌑𐌏𐌈𐌎𐌐𐌒𐌓𐌔𐌖𐌗𐌘𐌙𐌚𐌞𐌡𐌜𐌢𐌝',275 'Quis custodiet ipsos custodes?',276 'Tempori parce!',277 '𐌍𐌏𐌍 𐌐𐌄𐌍𐌉𐌔 𐌂𐌀𐌍𐌉𐌍𐌀',278 ]279 control_set = [280 'abcdefghiklmnopqrstvxyzabcdevzhilmnshothshpqrsuxphkhfuvchxi',281 'ABCDEFGHIKLMNOPQRSTVXYZabcdevzhilmnshothshpqrsuxphkhfuvchxi',282 'aBcDeFgHiKlMnOpQrStVxYzabcdevzhilmnshothshpqrsuxphkhfuvchxi',283 'AbCdEfGhIkLmNoPqRsTvXyZabcdevzhilmnshothshpqrsuxphkhfuvchxi',284 'Quis custodiet ipsos custodes?',285 'Tempori parce!',286 'non penis canina',287 ]288 resulting_set = [mg.la_en(item).string for item in testing_set]289 self.assertEqual( control_set, resulting_set )290 def test_RuEn_Transliteration(self):291 mg = Metagrapher()292 testing_set = [293 'абвгдеёжзийклмнопрстуфхцчшщьъэюя',294 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЪЭЮЯ',295 'АбВгДеЁжЗиЙкЛмНоПрСтУфХцЧшЩьЪэЮя',296 'аБвГдЕёЖзИйКлМнОпРсТуФхЦчШщЬъЭюЯ',297 'Щавель ЩАВЕЛЬ щавель',298 'шчастье Шчастье ШЧАСТЬЕ',299 'Юлия Чичерина ЮЛЯ ЧИЧЕРИНА юлия чичерина',300 'Эпос о великой мудрости сакуры, печально роняющей листья на водную гладь.',301 ]302 control_set = [303 'abvgdeyozhziyklmnoprstufhcchshscheyuya',304 'ABVGDEYOZHZIYKLMNOPRSTUFHCCHSHSCHEYUYA',305 'AbVgDeYozhZiYkLmNoPrStUfHcChshScheYuya',306 'aBvGdEyoZhzIyKlMnOpRsTuFhCchShschEyuYA',307 'Schavel SCHAVEL schavel',308 'shchaste Shchaste SHCHASTE',309 'Yuliya Chicherina YULYA CHICHERINA yuliya chicherina',310 'Epos o velikoy mudrosti sakury, pechalno ronyayuschey listya na vodnuyu glad.',311 ]312 resulting_set = [mg.ru_en(item).string for item in testing_set]313 self.assertEqual( control_set, resulting_set )314 def test_LtEn_Transliteration(self):315 mg = Metagrapher()316 testing_set = [317 'aąbcčdeęėfghiįyjklmnoprsštuųūvzž',318 'AĄBCČDEĘĖFGHIĮYJKLMNOPRSŠTUŲŪVZŽ',319 'AąBcČdEęĖfGhIįYjKlMnOpRsŠtUųŪvZž',320 'aĄbCčDeĘėFgHiĮyJkLmNoPrSšTuŲūVzŽ',321 'Gera pradžia — pusė darbo',322 'Katė glostoma kuprą kelią',323 'Liga raita atjoja, pėščia išeina',324 ]325 control_set = [326 'aabtschdeeefghiiijklmnoprsshtuuuvzzh',327 'AABTSCHDEEEFGHIIIJKLMNOPRSSHTUUUVZZH',328 'AaBtsChdEeEfGhIiIjKlMnOpRsShtUuUvZzh',329 'aAbTschDeEeFgHiIiJkLmNoPrSshTuUuVzZH',330 'Gera pradzhia — puse darbo',331 'Kate glostoma kupra kelia',332 'Liga raita atjoja, peshchia isheina',333 ]334 resulting_set = [mg.lt_en(item).string for item in testing_set]335 self.assertEqual( control_set, resulting_set )336 # Metagrapher("Oriģināli šis ēdiens ir nācis no Vācijas un arī vārds quiche ir cēlies no vārda “kuchen”, kas patiesībā nozīmē neko citu kā kūka.").lv_en()337 # Metagrapher("Брзата кучка слепи кучиња раѓа. Џабе работи, џабе не седи. Низ sид со глава не бива. Što edna budala će zapletka, iljada mudreci ne možat da otpletkat.").mk_en()338 # Metagrapher("Millî Folklor: Al elmaya taş atan çok olur. Elma kendi ağacından īrak düşmez.").tr_en()339class LangAuto(unittest.TestCase):340 pass341class Symbols(unittest.TestCase):342 pass343class InstantiationAndChaining(unittest.TestCase):344 def test_instantiation_with_text(self):345 m = Metagrapher('а Тест')346 self.assertEqual(347 m.ru_en().get(),348 'a Test'349 )350 def test_instantiation_str(self):351 self.assertIn(352 str(Metagrapher('Just Test')),353 'Just Test'354 )355 def test_instantiation_str_just_upper(self):356 self.assertIn(357 str(Metagrapher('Just Test').upper()),358 'JUST TEST'359 )360 def test_instantiation_str_just_lower(self):361 self.assertIn(362 str(Metagrapher('Just Test').lower()),363 'just test'364 )365 def test_instantiation_get(self):366 self.assertIn(367 Metagrapher('Just Test').get(),368 'Just Test'369 )370 def test_instantiation_string(self):371 self.assertIn(372 Metagrapher('Just Test').string,373 'Just Test'374 )375 def test_instantiation_upper_get(self):376 self.assertEqual(377 Metagrapher('lower case string').upper().get(),378 'LOWER CASE STRING'379 )380 def test_instantiation_lower_alias(self):381 self.assertEqual(382 Metagrapher('UPPER CASE STRING').lower().text(),383 'upper case string'384 )385 def test_instantiation_upper_selfvalue(self):386 self.assertEqual(387 Metagrapher('lower case string').upper().string,388 'LOWER CASE STRING'389 )390if __name__ == "__main__":...

Full Screen

Full Screen

engine.py

Source:engine.py Github

copy

Full Screen

1import sys2import pygame3from Engine.ui import Menu_Button4from Engine.lib.common import setup_screen5from Engine.lib.storage import Swap6from Engine.lib.uinput import UInput7from Engine.lib.console import Console8from Engine.lib.resource import Resource9from Engine.lib.interface import animation_no_collision, version_information10from Engine.lib.player import Player11from Level.level import Level12class Engine:13 def __init__(self):14 self.screen = setup_screen()15 if pygame.get_init():16 # create Swap space -> Global Variables17 self.engine_swap = Swap()18 # create Control Object -> all functions for user input19 self.control_set = UInput(self.engine_swap)20 # init console Object -> all console functions !default "F1"21 self.engine_console = Console(self.screen, self.engine_swap)22 # get Resource pack -> all preloaded assets23 self.resource_pack = Resource(skin=None)24 # init clock25 self.clock = pygame.time.Clock()26 # Engine main loop // scene handler27 def main_loop(self):28 self.screen.fill((155, 155, 155))29 # read game status -> redirect to game state function30 # loading31 if self.engine_swap.game_status == -1:32 self.control_set.keys_disabled = True33 self.control_set.esc_quit = False34 self.control_set.enable_mouse_click = False35 self.splash()36 # main menu37 if self.engine_swap.game_status == 0:38 self.control_set.keys_disabled = True39 self.control_set.esc_quit = True40 self.control_set.enable_mouse_click = True41 self.main_menu()42 # sandbox game43 if self.engine_swap.game_status == 1337:44 self.control_set.keys_disabled = True45 self.control_set.esc_quit = True46 self.control_set.enable_mouse_click = True47 self.sandbox()48 else:49 self.engine_swap.game_status = 050 self.control_set.keys_disabled = True51 self.control_set.esc_quit = True52 self.control_set.enable_mouse_click = True53 self.main_menu()54 pygame.display.flip()55 self.clock.tick(10)56 # loading/splash screen == game_status -157 def splash(self):58 loading_indicator = animation_no_collision(self.screen, self.resource_pack)59 jobs = 560 while True:61 self.screen.blit(self.resource_pack.load_background, (0, 0))62 version_information(self.screen, "1.01")63 self.control_set.handle_window()64 loading_indicator.draw((500, 640))65 loading_indicator.tick()66 jobs -= 167 if jobs < 0:68 self.engine_swap.game_status = 069 break70 pygame.display.flip()71 self.clock.tick(1)72 # main_menu screen == game_status 073 def main_menu(self):74 while True:75 self.control_set.handle_window()76 self.screen.blit(self.resource_pack.menu_background, (0, 0))77 version_information(self.screen, "1.01")78 # menu buttons79 btn_play = Menu_Button(self.screen, 426, 120, "Play", self.resource_pack, 160)80 if btn_play.check_collision(pygame.mouse.get_pos()):81 if self.engine_swap.mouse_left_click:82 print("collide play")83 self.control_set.reset_mouse()84 btn_player_saves = Menu_Button(self.screen, 426, 240, "Player & Saves", self.resource_pack, 40)85 if btn_player_saves.check_collision(pygame.mouse.get_pos()):86 if self.engine_swap.mouse_left_click:87 print("collide player_saves")88 self.control_set.reset_mouse()89 btn_settings = Menu_Button(self.screen, 426, 360, "Settings", self.resource_pack, 100)90 if btn_settings.check_collision(pygame.mouse.get_pos()):91 if self.engine_swap.mouse_left_click:92 print("collide settings")93 self.control_set.reset_mouse()94 btn_quit = Menu_Button(self.screen, 426, 480, "QUIT", self.resource_pack, 140)95 if btn_quit.check_collision(pygame.mouse.get_pos()):96 if self.engine_swap.mouse_left_click:97 pygame.quit()98 sys.exit()99 self.engine_console.main_loop()100 if self.engine_swap.game_status != 0:101 break102 # update103 pygame.display.flip()104 self.clock.tick(30)105 # sandbox == game_status 1337106 def sandbox(self):107 lvl = Level(self.screen, self.engine_swap)108 lvl.read_level_data("demo")109 player = Player(self.screen, self.engine_swap, self.resource_pack, 400, 300, 32, 32)110 while True:111 self.control_set.handle_window()112 self.screen.blit(self.resource_pack.menu_background, (0, 0))113 version_information(self.screen, "1.01")114 # draw map115 for tile in lvl.tile_maps:116 tile.draw()117 # draw player118 player.mainloop()119 self.engine_console.main_loop()120 if self.engine_swap.game_status != 1337:121 break122 # update123 pygame.display.flip()...

Full Screen

Full Screen

test_control_set.py

Source:test_control_set.py Github

copy

Full Screen

1from ..control import Control2from ..control_set import ControlSet3def test_get_implementation_for():4 control1 = Control("AC-1")5 control1.implementation = {"A": "foo"}6 control2 = Control("AC-2")7 control2.implementation = {"A": "bar"}8 control_set = ControlSet([control1, control2])9 assert control_set.get_implementation_for("AC-2", "A").text == "bar"10 assert control_set.get_implementation_for("baz", "A") == None11 assert control_set.get_implementation_for("AC-2", "Z") == None12def test_num_unique_implementations():13 control1 = Control("AC-1")14 control1.implementation = {"A": "foo"}15 control2 = Control("AC-2")16 control2.implementation = {"A": "foo"}17 control3 = Control("AC-3")18 control3.implementation = {"A": "bar"}19 control_set = ControlSet([control1, control2, control3])20 assert control_set.num_unique_implementations() == 221def test_num_tokens():22 control1 = Control("foo")23 control1.implementation = {"A": "foo - does things"}24 control2 = Control("bar")25 control2.implementation = {"A": "bar's a thinger do-er"}26 control_set = ControlSet([control1, control2])27 assert control_set.num_tokens() == 928def test_top_entities():29 control1 = Control("foo")30 control1.implementation = {31 "A": "FISMATic is the greatest thing to happen to the United States since sliced bread."32 }33 control2 = Control("bar")34 control2.implementation = {"A": "Have I told you how great FISMAtic is?"}35 control_set = ControlSet([control1, control2])36 # TODO this should have captured "FISMAtic"37 assert control_set.top_entities() == [("the United States", 1)]38def test_top_proper_noun_chunks():39 control1 = Control("foo")40 control1.implementation = {41 "A": "FISMATic is the greatest thing to happen to the United States since sliced bread."42 }43 control2 = Control("bar")44 control2.implementation = {"A": "Have I told you how great FISMAtic is?"}45 control_set = ControlSet([control1, control2])46 # TODO this should have captured "FISMAtic"47 assert control_set.top_proper_noun_chunks() == [("the United States", 1)]48def test_control_names():49 control1 = Control("AC-2")50 control1.implementation = {"": ""}51 control2 = Control("AU-6(1)")52 control2.implementation = {"": ""}53 control_set = ControlSet([control1, control2])...

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