Best Python code snippet using autotest_python
tests.py
Source:tests.py
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__":...
engine.py
Source:engine.py
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()...
test_control_set.py
Source:test_control_set.py
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])...
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!!