From 8d65b5d8e53ebbdf6d1395bb254c41221246f865 Mon Sep 17 00:00:00 2001 From: Vitaliy Gulevatiy Date: Sun, 25 Jan 2026 19:16:34 +0300 Subject: [PATCH 1/6] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1_task/.coverage | Bin 0 -> 53248 bytes 1_task/.idea/1_task.iml | 12 ++++ .../inspectionProfiles/profiles_settings.xml | 6 ++ 1_task/.idea/misc.xml | 7 ++ 1_task/.idea/modules.xml | 8 +++ 1_task/.idea/vcs.xml | 6 ++ 1_task/.idea/workspace.xml | 54 ++++++++++++++ 1_task/praktikum | 1 + 1_task/requirements.txt | 0 1_task/tests/__init__.py | 0 .../__pycache__/__init__.cpython-314.pyc | Bin 0 -> 157 bytes .../test_bun.cpython-314-pytest-9.0.2.pyc | Bin 0 -> 3978 bytes .../test_burger.cpython-314-pytest-9.0.2.pyc | Bin 0 -> 9517 bytes ...test_database.cpython-314-pytest-9.0.2.pyc | Bin 0 -> 6707 bytes ...st_ingredient.cpython-314-pytest-9.0.2.pyc | Bin 0 -> 6253 bytes 1_task/tests/test_bun.py | 17 +++++ 1_task/tests/test_burger.py | 67 ++++++++++++++++++ 1_task/tests/test_database.py | 23 ++++++ 1_task/tests/test_ingredient.py | 24 +++++++ 19 files changed, 225 insertions(+) create mode 100644 1_task/.coverage create mode 100644 1_task/.idea/1_task.iml create mode 100644 1_task/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 1_task/.idea/misc.xml create mode 100644 1_task/.idea/modules.xml create mode 100644 1_task/.idea/vcs.xml create mode 100644 1_task/.idea/workspace.xml create mode 160000 1_task/praktikum create mode 100644 1_task/requirements.txt create mode 100644 1_task/tests/__init__.py create mode 100644 1_task/tests/__pycache__/__init__.cpython-314.pyc create mode 100644 1_task/tests/__pycache__/test_bun.cpython-314-pytest-9.0.2.pyc create mode 100644 1_task/tests/__pycache__/test_burger.cpython-314-pytest-9.0.2.pyc create mode 100644 1_task/tests/__pycache__/test_database.cpython-314-pytest-9.0.2.pyc create mode 100644 1_task/tests/__pycache__/test_ingredient.cpython-314-pytest-9.0.2.pyc create mode 100644 1_task/tests/test_bun.py create mode 100644 1_task/tests/test_burger.py create mode 100644 1_task/tests/test_database.py create mode 100644 1_task/tests/test_ingredient.py diff --git a/1_task/.coverage b/1_task/.coverage new file mode 100644 index 0000000000000000000000000000000000000000..045e92c0b5b5ef3a16d80165e55242f23d8441bc GIT binary patch literal 53248 zcmeI)&2QUe90zbacI+li;=&kFS519DLS41ABiaENn^@abVho85HpHRAbCM^mX<}!# zv$Y4PGA4%j6A*s^h$|yzU9V{c?5H#$$+C2kF-ej#^vKgAnRJ>_lLdN}`{swuW~BK~p2{0< zOF8Ww$#^$^z?jRe=KdJ}EcasO!nm!MGV`;^<@^VV~4Vgrnxz`z&!T~YjKa&?FMJIQ?sj9U^}ZUSmVjw zZJ*b~F^ksGQA_MNAEp;`rd^{{0bivMEzfRR-X>e;o277v_}v1&5kxB}2)9=qu?IU8 zC!b{=uXB$(RqjW*IAqsmv$G#=W%c5|ee!i4mdWy}^fx|G8d}jS%IP`QfY){`U`e1Q6XErjhGJb5 z1-clejNhwIr_!DDu+@;ZydP8QVvTS zxN%|cyKZ)<%U*d0sxu)MH5#RAJNBhE?^b?^^-`9?VmNMzi9%2dcy3%PzO+x4s8#X} z|5AfKI+<2GaKmMjD&H*AQ|{UmV|sCVTE2cMY$$@qtk{9yoyiO|n(pc$O-F1W-fl!M z8Ehn?7d0Bpt%qGkq-Ig&P;2h*Ge;5(%M%@qx$%ya(}&vHL}n=utkQ5RgKaHrF+Qgb zLSsR)TfOa6MOX1f8LIAO?pdpRKHeG)3lF;?QPU}BwBqvgu%^>(0%o~8o9#?$dU0w> zzM2V}QCwT`i$2hVlA7FM7)>@cx#hRLWFWcMAep4-jgm=^j z#j|#8A{A!&V9mSua?WoZnKjsQ&TShHwntKznU zu>Fd~uz8AOPcOewfZlRqPkYUVyHoc*>-xS;hgEUd@{c8J+02^di&4m*VHMYHaLb8~ z4V2=vPw#2_EX>2*N2OPKG5k#tWA*Y(n5X36B8K_%)ajD`MKjH&<<#Qil{gGXQEBWK zom0F|G>A|_Hbb4#r!KlJW)d{sDn_g%{(Or}MAW8Li@Lk0l)i{p*7#lFqNC9%E8v0M zH?v?UosqteXIDEDeRqKeJ3cot{LW8$M+ zXIj>ahY!o0cHD!b!O8ULlR(o-${H`G23pp(jlD+p294765vjj%3GhBcu^7FB7!jjt zuS9goUhxN{?5sG!myJ6T{b7Ot1Rwwb2tWV=5P$##AOHafKw$R?C~`{H#rc2A_(?Ku z(-S5LKmY;|fB*y_009U<00Izz00bUOfm}*CXe9p@^8AFXOijlB1MtFp`RIH(OQlK~ zwvrK(S?PNv?(s%x^ol!fJqr}+Z{6D>{cJdDvi%O*~sGamEQM%{< z$_Zs_v;gA#Keb4zqg++#JO9V;|LwUBjRHde0uX=z1Rwwb2tWV=5P-nm5>RAC%8UE| zvhklpf0!Tu0SG_<0uX=z1Rwwb2tWV=5ZHwRijvQW`~RBpon-uL{BHbg{9t@f3z#4P z0SG_<0uX=z1Rwwb2tWV=5P0MSG)B@L@^)$0SG_<0uX=z1Rwwb2tWV=Lj=V4|8f351P7}j Y009U<00Izz00bZa0SG_<0=q=ue=e1^Qvd(} literal 0 HcmV?d00001 diff --git a/1_task/.idea/1_task.iml b/1_task/.idea/1_task.iml new file mode 100644 index 000000000..f55cd921e --- /dev/null +++ b/1_task/.idea/1_task.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/1_task/.idea/inspectionProfiles/profiles_settings.xml b/1_task/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 000000000..105ce2da2 --- /dev/null +++ b/1_task/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/1_task/.idea/misc.xml b/1_task/.idea/misc.xml new file mode 100644 index 000000000..590a59e60 --- /dev/null +++ b/1_task/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/1_task/.idea/modules.xml b/1_task/.idea/modules.xml new file mode 100644 index 000000000..fe0b02624 --- /dev/null +++ b/1_task/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/1_task/.idea/vcs.xml b/1_task/.idea/vcs.xml new file mode 100644 index 000000000..5c4e74dbb --- /dev/null +++ b/1_task/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/1_task/.idea/workspace.xml b/1_task/.idea/workspace.xml new file mode 100644 index 000000000..6bdc03058 --- /dev/null +++ b/1_task/.idea/workspace.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 1769188965711 + + + + \ No newline at end of file diff --git a/1_task/praktikum b/1_task/praktikum new file mode 160000 index 000000000..c7c7e92ac --- /dev/null +++ b/1_task/praktikum @@ -0,0 +1 @@ +Subproject commit c7c7e92ac4cbbe887236dbb76c4c87e7792edab5 diff --git a/1_task/requirements.txt b/1_task/requirements.txt new file mode 100644 index 000000000..e69de29bb diff --git a/1_task/tests/__init__.py b/1_task/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/1_task/tests/__pycache__/__init__.cpython-314.pyc b/1_task/tests/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..464145d596ed577846cbbac06c2f09604efdc2ca GIT binary patch literal 157 zcmdPq_I|p@<2{{|u76W#w!Y6Iz^F zR2-9(pP!u=Q<<2Tl3Ec^l$cx+lag7Glb;)77+;cDoE=k=T3k{b6Ca2KczG$)vkyYXcWk@Vi4mKGb1Bo5i^hl0A4L6<^TWy literal 0 HcmV?d00001 diff --git a/1_task/tests/__pycache__/test_bun.cpython-314-pytest-9.0.2.pyc b/1_task/tests/__pycache__/test_bun.cpython-314-pytest-9.0.2.p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rF0NEp2a(jVqU3cFLn32%4m*TT=dxXVYPC|R qmW*jO3`6)|pM{L_yGSYhm5{HWP$eaum1#%3zwY$ literal 0 HcmV?d00001 diff --git a/1_task/tests/__pycache__/test_burger.cpython-314-pytest-9.0.2.pyc b/1_task/tests/__pycache__/test_burger.cpython-314-pytest-9.0.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6ae93d2f63949358eb6d6ac9850dac7b3c4b503c GIT binary patch literal 9517 zcmeI2O-vlg6@a^EdVZLO!GQm;Aq?1#J;63VgTa3!YXfUoJ1pC=$Br~&G=^C`VPJ;p z#%qXHBGO86lvT2)h$ELA_7vxqLk@e)kzx3;TDI1QC{k{bos%!gd(~Z4Jxx0Ume;v# zYp8xz^{Tq6f4=wX6`j$#hy=&QKk2!@h9qeUGwkr$!mCFhtVolRCXY#mOwYbi|Dvx= z8dZ!y8`k*7f}Wkx(k4xX^q?l6km9xf#9@rbWixnvk<4TXNdD`K^Kgoc&CihRbS^t@#C_(W zvGE()$ne<6`0e!VpHGaWe|GK8(1>}&UHswLty@r5G1VHlgdhH1eF2kRky0{V6OTUY zBo(C;*3(0iCa3%Cn^TmN(nNsOh;vfzv-@b1KqDw>n6%K5lrN4-(n8|2T{QC_NotW& zVWu%b9}UY{=XOb}N%|AA7P;G=@bxKHsU~Z_R4vn-h%!l>+xbi`LE%iR>q-ZNCX?D> z+-wePgwsb{?HZZ3I6K?@6vn0b9W(OQ_p$3}iWc||=E0xEKIg&P!8`(8{xktd}eAkc7Ji+^cR=9 z&ES3d`eUXSlRncAb+4ltUC$CDcIr%VsXwk`P5=1U@@wDVU|e4A#Nyt#9{Hs$#0IHm zcU(UYts|eu2Cag=xE`-1_*N5q(ao@)HPWD=lRC^sJ}533S=~ryh}n>y%H;EDk}Z;{ z!dx*!vSuw*gLW=&zPlp*n=6p zM#rBk%#RRKAZAng(*l{x80qYzVm>pUF`yVBaxn@KHY=BKldCP-$=NKNO8`NCYPCv9Z(*%Z!KrzuPg$#cHA zW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ycask0VSHf!mPTC3+tTp07aO5%X+%4R zm1Q#p3&`66$H1k-TgSAt^*H_>#09NmzrUFx=1f5d>*4$S>59<3{$fB_kG>+);4=g*w#Fwlv z@g?r>k0MgNLnB^+;~5AI7fEg^8~OZ9T)6oI0OA88giP=aBj5;HK@foua~Vz+nxhoWVqhPE4hCCX{`?yPyMJe} zZlrW}!I}b@#$!BSjc`6*Qjf1IC)d^EWwjNAwI-UB)RQ}k{VQX2E6;KPqr$ezhH{eS zwrOWp&8DLz$ZHTM7Tt0gTI?n&GLI7VA{f;1>A+&W>Ymk*s8gd@hcc3}|%`?QWlQHW%xvbmx`t^%~I zRnT(NptS)K<69xI!R5#VTHwpE-V5F26zD?Oj<1aD%?`)P2r2G1$cPYAMU%&_xz|;Z z9dV=9_$2mx3zMHz_B7TDI5W^9ZTEh#uUD z#!AsxIoh#u;{`_0&aKUq)N?zE{VOZyXz&cPTMn5kY-0*m%*lpBgczDfSRZ3k#(hGb)baNKKoZzIv!uOa$7>= z)!V4ga~l;oUJSyf(m~CA{E!)D`}TAdY&NH@o&NJyh!}R?&y(zDBxk^`JufohHKk?L zfin*jNoLl_%`VQtKNa9kIrRd~I%n~`^?wBiMVZ({qh6wU%&RJGEETgl-G;L~$QZmS zbQ_GIStq!7Cg`jYe2u=A=&UT4E_`*aFuj=1{+Qf@DtNaf9X*48`DI!DR+7Guwxko! srPk+C=eN?GmqA5teHm5cvoE6o`OM1$HFEdMqpE!B-z~NB3EJy_0kUV=LjV8( literal 0 HcmV?d00001 diff --git a/1_task/tests/__pycache__/test_database.cpython-314-pytest-9.0.2.pyc b/1_task/tests/__pycache__/test_database.cpython-314-pytest-9.0.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4276f20b08de6b821855fe8425806c3e91087802 GIT binary patch literal 6707 zcmeHL&u<&Y6`th|DUvIZu^dN<8&#s{INVsJMUhIJ#Bv))38We|m_@=~h!87rqcEaK zdUn;?E(8cg4=F03Mo&HXkb@6)a%lgBApZa@s$#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-Uag#bG!aHI#Jj|2eX z&pNDN9#B5M%@CjLc+CWWwe-fC!D2ALuvkbs=51Q9nHGwL>ucU7c5XJlAHsVdIlKzZ z44HyQ-uvX;GtRrCuq#Pr@pj1{V>ihTyb51~O%o$OCK^eT1-T|YkglsCb{=9ed_<}t zJCp@dgiHY=oS$aX(Alxe>qY|*oL#ZcyS(97dabUn)(xNu4KsV$r3hED!Va&*JPXYu z$grI#Jh1M|ySM+GzH0*Fz;pi#>-$4^V3XfYPDzhv|FasprL$$AE2_t75_(S}?v-R9 zF2ffdhJP`33LB^pVYurU{%zRv*vvzth8_ChRzAQ%@OvbhJ2bWXh8WoE(Zn!# z-l+-=i~^b%2BW)6LIWeN9ne&JVBLM1`WkOoCsAnA0`P)Fp`)O9pcJ~a=j`CT7~Au; z16lw#cV-{t0Z*7>Gf3qRz~|zZ*Z%qm;PWf@KItZN?PTt&Yu~duuwglD9HjIh_lys@fhC?E zd7bLw%NSe0=2d9=5%%npFO4mNJz{+y(2k$&j?Xw4JwQD_64wrBraiFkKFxfcfXa6g#WpP>&=xxi ziU&%uOMA`^&Wo`zm_wuN@fOoJtlGxbW|n^raX&7N`4hkh9WrS@>yP<6h2e&FzMeQ7$+>?I zh?AmAr=piPo7JtlafQ7LmdI(%G&KK|B}w`RA-^MkBQJkTCch;YzKh7xE8mS$Y2jZ9 KD!nH;LH-TSP!G!h literal 0 HcmV?d00001 diff --git a/1_task/tests/__pycache__/test_ingredient.cpython-314-pytest-9.0.2.pyc b/1_task/tests/__pycache__/test_ingredient.cpython-314-pytest-9.0.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9866d0755e1097bcdbb259101595b886be26021e GIT binary patch literal 6253 zcmeHLO>7fK6rQ!mzncUCq)y#EKJdW;ZIK zs)W=Y=&84gLl0azl|v64xs_uayK%K@#ksc%dg9dgW`Au$eoCuWw5#>(oA=(lnVs4B z-Zwtf(i|sn^?s)pdV_@Iu;N?+TX=p2gga!4$U>SJ0)Ga^gG+%nAHc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KFXM&La#Z179^j{|ea(G+#_Rsx|6mB3QR7R|!4MZfg z4I<+Hx#1%sHrB8nnd8iDF*jQ%7OcbTx-f&u;pL<2NsEr0d>z=aj;(&!fdjF_MvzpS z9CpxctFR-58^{Pdgu{pbIBi;D@s5;^oXese7VGeUiFbD#%*b%`@1bxHUL%itDyRjZ!6XzeZXR5aBv=A`A=EFfCIOyG9$K*&$_usW9pnym|L13@Xn{4 zGMf9>GbuQOI{#!Ca!P)RWk}-~;yuH;eL(mCt+|iBKVO<&D(26yGhl*rNA!bG{1y}h i;VB_sk{`*Tr{wChFco^9wFCs|Sv(*N{0_w_9_0@bTk{S8 literal 0 HcmV?d00001 diff --git a/1_task/tests/test_bun.py b/1_task/tests/test_bun.py new file mode 100644 index 000000000..7208c2fe4 --- /dev/null +++ b/1_task/tests/test_bun.py @@ -0,0 +1,17 @@ +from praktikum.bun import Bun + + +def test_bun_init(): + bun = Bun("black bun", 100) + assert bun.name == "black bun" + assert bun.price == 100 + + +def test_get_name(): + bun = Bun("white bun", 200) + assert bun.get_name() == "white bun" + + +def test_get_price(): + bun = Bun("red bun", 300) + assert bun.get_price() == 300 diff --git a/1_task/tests/test_burger.py b/1_task/tests/test_burger.py new file mode 100644 index 000000000..5c6bff516 --- /dev/null +++ b/1_task/tests/test_burger.py @@ -0,0 +1,67 @@ +from praktikum.burger import Burger +from praktikum.bun import Bun +from praktikum.ingredient import Ingredient +from praktikum.ingredient_types import INGREDIENT_TYPE_SAUCE, INGREDIENT_TYPE_FILLING + + +def test_set_buns(): + burger = Burger() + bun = Bun("black bun", 100) + burger.set_buns(bun) + assert burger.bun == bun + + +def test_add_ingredient(): + burger = Burger() + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) + burger.add_ingredient(ingredient) + assert ingredient in burger.ingredients + + +def test_remove_ingredient(): + burger = Burger() + ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) + burger.add_ingredient(ingredient) + burger.remove_ingredient(0) + assert len(burger.ingredients) == 0 + + +def test_move_ingredient(): + burger = Burger() + ingredient1 = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) + ingredient2 = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) + burger.add_ingredient(ingredient1) + burger.add_ingredient(ingredient2) + + burger.move_ingredient(0, 1) + assert burger.ingredients[0] == ingredient2 + assert burger.ingredients[1] == ingredient1 + + +def test_get_price(): + burger = Burger() + bun = Bun("black bun", 100) + burger.set_buns(bun) + + ingredient1 = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 50) + ingredient2 = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 150) + + burger.add_ingredient(ingredient1) + burger.add_ingredient(ingredient2) + + assert burger.get_price() == 400 # 100*2 + 50 + 150 + + +def test_get_receipt(): + burger = Burger() + bun = Bun("black bun", 100) + burger.set_buns(bun) + + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 50) + burger.add_ingredient(ingredient) + + receipt = burger.get_receipt() + + assert "(==== black bun ====)" in receipt + assert "= sauce hot sauce =" in receipt + assert "Price: 250" in receipt diff --git a/1_task/tests/test_database.py b/1_task/tests/test_database.py new file mode 100644 index 000000000..d33fd119c --- /dev/null +++ b/1_task/tests/test_database.py @@ -0,0 +1,23 @@ +from praktikum.database import Database +from praktikum.bun import Bun +from praktikum.ingredient import Ingredient + + +def test_database_init(): + database = Database() + assert len(database.buns) == 3 + assert len(database.ingredients) == 6 + + +def test_available_buns(): + database = Database() + buns = database.available_buns() + assert isinstance(buns, list) + assert all(isinstance(bun, Bun) for bun in buns) + + +def test_available_ingredients(): + database = Database() + ingredients = database.available_ingredients() + assert isinstance(ingredients, list) + assert all(isinstance(ingredient, Ingredient) for ingredient in ingredients) diff --git a/1_task/tests/test_ingredient.py b/1_task/tests/test_ingredient.py new file mode 100644 index 000000000..bd3bd99ff --- /dev/null +++ b/1_task/tests/test_ingredient.py @@ -0,0 +1,24 @@ +from praktikum.ingredient import Ingredient +from praktikum.ingredient_types import INGREDIENT_TYPE_SAUCE, INGREDIENT_TYPE_FILLING + + +def test_ingredient_init(): + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) + assert ingredient.type == INGREDIENT_TYPE_SAUCE + assert ingredient.name == "hot sauce" + assert ingredient.price == 100 + + +def test_get_price(): + ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) + assert ingredient.get_price() == 200 + + +def test_get_name(): + ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "sausage", 300) + assert ingredient.get_name() == "sausage" + + +def test_get_type(): + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "chili sauce", 150) + assert ingredient.get_type() == INGREDIENT_TYPE_SAUCE From 28a24c47022134b120d4dae43bc9c3db00386d84 Mon Sep 17 00:00:00 2001 From: Vitaliy Gulevatiy Date: Sat, 7 Feb 2026 15:48:57 +0300 Subject: [PATCH 2/6] Remove unnecessary praktikum directory from task 1 --- 1_task/praktikum | 1 - 1 file changed, 1 deletion(-) delete mode 160000 1_task/praktikum diff --git a/1_task/praktikum b/1_task/praktikum deleted file mode 160000 index c7c7e92ac..000000000 --- a/1_task/praktikum +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c7c7e92ac4cbbe887236dbb76c4c87e7792edab5 From 82e98a0ead52890c801b600dafe9e101aaac98f3 Mon Sep 17 00:00:00 2001 From: Vitaliy Gulevatiy Date: Sat, 7 Feb 2026 15:49:09 +0300 Subject: [PATCH 3/6] Add gitignore --- .gitignore | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..87ec0dcb5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +# IDE +.idea/ + +# Python +__pycache__/ +*.py[cod] + +# Virtual environments +.venv/ +venv/ + +# Tests / coverage +.pytest_cache/ +.coverage +htmlcov/ + +# OS +.DS_Store +Thumbs.db From b12a3fe9f8c9c674d09419a74ae1de1e380139d8 Mon Sep 17 00:00:00 2001 From: Vitaliy Gulevatiy Date: Sat, 7 Feb 2026 16:14:26 +0300 Subject: [PATCH 4/6] Fix tests structure and remove __pycache__ --- .../__pycache__/__init__.cpython-314.pyc | Bin 157 -> 0 bytes .../test_bun.cpython-314-pytest-9.0.2.pyc | Bin 3978 -> 0 bytes .../test_burger.cpython-314-pytest-9.0.2.pyc | Bin 9517 -> 0 bytes ...test_database.cpython-314-pytest-9.0.2.pyc | Bin 6707 -> 0 bytes ...st_ingredient.cpython-314-pytest-9.0.2.pyc | Bin 6253 -> 0 bytes 1_task/tests/test_bun.py | 23 ++--- 1_task/tests/test_burger.py | 96 ++++++++++-------- 1_task/tests/test_database.py | 30 +++--- 1_task/tests/test_ingredient.py | 31 +++--- 9 files changed, 93 insertions(+), 87 deletions(-) delete mode 100644 1_task/tests/__pycache__/__init__.cpython-314.pyc delete mode 100644 1_task/tests/__pycache__/test_bun.cpython-314-pytest-9.0.2.pyc delete mode 100644 1_task/tests/__pycache__/test_burger.cpython-314-pytest-9.0.2.pyc delete mode 100644 1_task/tests/__pycache__/test_database.cpython-314-pytest-9.0.2.pyc delete mode 100644 1_task/tests/__pycache__/test_ingredient.cpython-314-pytest-9.0.2.pyc diff --git a/1_task/tests/__pycache__/__init__.cpython-314.pyc b/1_task/tests/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 464145d596ed577846cbbac06c2f09604efdc2ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 157 zcmdPq_I|p@<2{{|u76W#w!Y6Iz^F zR2-9(pP!u=Q<<2Tl3Ec^l$cx+lag7Glb;)77+;cDoE=k=T3k{b6Ca2KczG$)vkyYXcWk@Vi4mKGb1Bo5i^hl0A4L6<^TWy diff --git a/1_task/tests/__pycache__/test_bun.cpython-314-pytest-9.0.2.pyc b/1_task/tests/__pycache__/test_bun.cpython-314-pytest-9.0.2.pyc deleted file mode 100644 index 5e320c545b525e83600e411af3b8a990c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n32%4m*TT=dxXVYPC|R qmW*jO3`6)|pM{L_yGSYhm5{HWP$eaum1#%3zwY$ diff --git a/1_task/tests/__pycache__/test_burger.cpython-314-pytest-9.0.2.pyc b/1_task/tests/__pycache__/test_burger.cpython-314-pytest-9.0.2.pyc deleted file mode 100644 index 6ae93d2f63949358eb6d6ac9850dac7b3c4b503c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9517 zcmeI2O-vlg6@a^EdVZLO!GQm;Aq?1#J;63VgTa3!YXfUoJ1pC=$Br~&G=^C`VPJ;p z#%qXHBGO86lvT2)h$ELA_7vxqLk@e)kzx3;TDI1QC{k{bos%!gd(~Z4Jxx0Ume;v# zYp8xz^{Tq6f4=wX6`j$#hy=&QKk2!@h9qeUGwkr$!mCFhtVolRCXY#mOwYbi|Dvx= z8dZ!y8`k*7f}Wkx(k4xX^q?l6km9xf#9@rbWixnvk<4TXNdD`K^Kgoc&CihRbS^t@#C_(W zvGE()$ne<6`0e!VpHGaWe|GK8(1>}&UHswLty@r5G1VHlgdhH1eF2kRky0{V6OTUY zBo(C;*3(0iCa3%Cn^TmN(nNsOh;vfzv-@b1KqDw>n6%K5lrN4-(n8|2T{QC_NotW& zVWu%b9}UY{=XOb}N%|AA7P;G=@bxKHsU~Z_R4vn-h%!l>+xbi`LE%iR>q-ZNCX?D> z+-wePgwsb{?HZZ3I6K?@6vn0b9W(OQ_p$3}iWc||=E0xEKIg&P!8`(8{xktd}eAkc7Ji+^cR=9 z&ES3d`eUXSlRncAb+4ltUC$CDcIr%VsXwk`P5=1U@@wDVU|e4A#Nyt#9{Hs$#0IHm zcU(UYts|eu2Cag=xE`-1_*N5q(ao@)HPWD=lRC^sJ}533S=~ryh}n>y%H;EDk}Z;{ z!dx*!vSuw*gLW=&zPlp*n=6p zM#rBk%#RRKAZAng(*l{x80qYzVm>pUF`yVBaxn@KHY=BKldCP-$=NKNO8`NCYPCv9Z(*%Z!KrzuPg$#cHA zWY*EUz;8|rItFe^`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tTp07aO5%X+%4R zm1Q#p3&`66$H1k-TgSAt^*H_>#09NmzrUFx=1f5d>*4$S>59<3{$fB_kG>+);4=g*w#Fwlv z@g?r>k0MgNLnB^+;~5AI7fEg^8~OZ9T)6oI0OA88giP=aBj5;HK@foua~Vz+nxhoWVqhPE4hCCX{`?yPyMJe} zZlrW}!I}b@#$!BSjc`6*Qjf1IC)d^EWwjNAwI-UB)RQ}k{VQX2E6;KPqr$ezhH{eS zwrOWp&8DLz$ZHTM7Tt0gTI?n&GLI7VA{f;1>A+&W>Ymk*s8gd@hcc3}|%`?QWlQHW%xvbmx`t^%~I zRnT(NptS)K<69xI!R5#VTHwpE-V5F26zD?Oj<1aD%?`)P2r2G1$cPYAMU%&_xz|;Z z9dV=9_$2mx3zMHz_B7TDI5W^9ZTEh#uUD z#!AsxIoh#u;{`_0&aKUq)N?zE{VOZyXz&cPTMn5kY-0*m%*lpBgczDfSRZ3k#(hGb)baNKKoZzIv!uOa$7>= z)!V4ga~l;oUJSyf(m~CA{E!)D`}TAdY&NH@o&NJyh!}R?&y(zDBxk^`JufohHKk?L zfin*jNoLl_%`VQtKNa9kIrRd~I%n~`^?wBiMVZ({qh6wU%&RJGEETgl-G;L~$QZmS zbQ_GIStq!7Cg`jYe2u=A=&UT4E_`*aFuj=1{+Qf@DtNaf9X*48`DI!DR+7Guwxko! srPk+C=eN?GmqA5teHm5cvoE6o`OM1$HFEdMqpE!B-z~NB3EJy_0kUV=LjV8( diff --git a/1_task/tests/__pycache__/test_database.cpython-314-pytest-9.0.2.pyc b/1_task/tests/__pycache__/test_database.cpython-314-pytest-9.0.2.pyc deleted file mode 100644 index 4276f20b08de6b821855fe8425806c3e91087802..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6707 zcmeHL&u<&Y6`th|DUvIZu^dN<8&#s{INVsJMUhIJ#Bv))38We|m_@=~h!87rqcEaK zdUn;?E(8cg4=F03Mo&HXkb@6)a%lgBApZa@s$#Q9(6etv)JuHod%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Jj|2eX z&pNDN9#B5M%@CjLc+CWWwe-fC!D2ALuvkbs=51Q9nHGwL>ucU7c5XJlAHsVdIlKzZ z44HyQ-uvX;GtRrCuq#Pr@pj1{V>ihTyb51~O%o$OCK^eT1-T|YkglsCb{=9ed_<}t zJCp@dgiHY=oS$aX(Alxe>qY|*oL#ZcyS(97dabUn)(xNu4KsV$r3hED!Va&*JPXYu z$grI#Jh1M|ySM+GzH0*Fz;pi#>-$4^V3XfYPDzhv|FasprL$$AE2_t75_(S}?v-R9 zF2ffdhJP`33LB^pVYurU{%zRv*vvzth8_ChRzAQ%@OvbhJ2bWXh8WoE(Zn!# z-l+-=i~^b%2BW)6LIWeN9ne&JVBLM1`WkOoCsAnA0`P)Fp`)O9pcJ~a=j`CT7~Au; z16lw#cV-{t0Z*7>Gf3qRz~|zZ*Z%qm;PWf@KItZN?PTt&Yu~duuwglD9HjIh_lys@fhC?E zd7bLw%NSe0=2d9=5%%npFO4mNJz{+y(2k$&j?Xw4JwQD_64wrBraiFkKFxfcfXa6g#WpP>&=xxi ziU&%uOMA`^&Wo`zm_wuN@fOoJtlGxbW|n^raX&7N`4hkh9WrS@>yP<6h2e&FzMeQ7$+>?I zh?AmAr=piPo7JtlafQ7LmdI(%G&KK|B}w`RA-^MkBQJkTCch;YzKh7xE8mS$Y2jZ9 KD!nH;LH-TSP!G!h diff --git a/1_task/tests/__pycache__/test_ingredient.cpython-314-pytest-9.0.2.pyc b/1_task/tests/__pycache__/test_ingredient.cpython-314-pytest-9.0.2.pyc deleted file mode 100644 index 9866d0755e1097bcdbb259101595b886be26021e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6253 zcmeHLO>7fK6rQ!mzncUCq)y#EKJdW;ZIK zs)W=Y=&84gLl0azl|v64xs_uayK%K@#ksc%dg9dgW`Au$eoCuWw5#>(oA=(lnVs4B z-Zwtf(i|sn^?s)pdV_@Iu;N?+TX=p2gga!4$U>SJ0)Ga^gG+%nAHc-)A05}EELhA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179^j{|ea(G+#_Rsx|6mB3QR7R|!4MZfg z4I<+Hx#1%sHrB8nnd8iDF*jQ%7OcbTx-f&u;pL<2NsEr0d>z=aj;(&!fdjF_MvzpS z9CpxctFR-58^{Pdgu{pbIBi;D@s5;^oXese7VGeUiFbD#%*b%`@1bxHUL%itDyRjZ!6XzeZXR5aBv=A`A=EFfCIOyG9$K*&$_usW9pnym|L13@Xn{4 zGMf9>GbuQOI{#!Ca!P)RWk}-~;yuH;eL(mCt+|iBKVO<&D(26yGhl*rNA!bG{1y}h i;VB_sk{`*Tr{wChFco^9wFCs|Sv(*N{0_w_9_0@bTk{S8 diff --git a/1_task/tests/test_bun.py b/1_task/tests/test_bun.py index 7208c2fe4..64fd3b085 100644 --- a/1_task/tests/test_bun.py +++ b/1_task/tests/test_bun.py @@ -1,17 +1,16 @@ from praktikum.bun import Bun -def test_bun_init(): - bun = Bun("black bun", 100) - assert bun.name == "black bun" - assert bun.price == 100 +class TestBun: + def test_bun_init(self): + bun = Bun("black bun", 100) + assert bun.name == "black bun" + assert bun.price == 100 + def test_get_name(self): + bun = Bun("white bun", 200) + assert bun.get_name() == "white bun" -def test_get_name(): - bun = Bun("white bun", 200) - assert bun.get_name() == "white bun" - - -def test_get_price(): - bun = Bun("red bun", 300) - assert bun.get_price() == 300 + def test_get_price(self): + bun = Bun("red bun", 300) + assert bun.get_price() == 300 diff --git a/1_task/tests/test_burger.py b/1_task/tests/test_burger.py index 5c6bff516..832b326c1 100644 --- a/1_task/tests/test_burger.py +++ b/1_task/tests/test_burger.py @@ -1,67 +1,73 @@ from praktikum.burger import Burger from praktikum.bun import Bun from praktikum.ingredient import Ingredient -from praktikum.ingredient_types import INGREDIENT_TYPE_SAUCE, INGREDIENT_TYPE_FILLING +from praktikum.ingredient_types import ( + INGREDIENT_TYPE_SAUCE, + INGREDIENT_TYPE_FILLING +) -def test_set_buns(): - burger = Burger() - bun = Bun("black bun", 100) - burger.set_buns(bun) - assert burger.bun == bun +class TestBurger: + def test_set_buns(self): + burger = Burger() + bun = Bun("black bun", 100) + burger.set_buns(bun) -def test_add_ingredient(): - burger = Burger() - ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) - burger.add_ingredient(ingredient) - assert ingredient in burger.ingredients + assert burger.bun == bun + def test_add_ingredient(self): + burger = Burger() + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) -def test_remove_ingredient(): - burger = Burger() - ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) - burger.add_ingredient(ingredient) - burger.remove_ingredient(0) - assert len(burger.ingredients) == 0 + burger.add_ingredient(ingredient) + assert ingredient in burger.ingredients -def test_move_ingredient(): - burger = Burger() - ingredient1 = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) - ingredient2 = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) - burger.add_ingredient(ingredient1) - burger.add_ingredient(ingredient2) + def test_remove_ingredient(self): + burger = Burger() + ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) - burger.move_ingredient(0, 1) - assert burger.ingredients[0] == ingredient2 - assert burger.ingredients[1] == ingredient1 + burger.add_ingredient(ingredient) + burger.remove_ingredient(0) + assert burger.ingredients == [] -def test_get_price(): - burger = Burger() - bun = Bun("black bun", 100) - burger.set_buns(bun) + def test_move_ingredient(self): + burger = Burger() + ingredient1 = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) + ingredient2 = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) - ingredient1 = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 50) - ingredient2 = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 150) + burger.add_ingredient(ingredient1) + burger.add_ingredient(ingredient2) + burger.move_ingredient(0, 1) - burger.add_ingredient(ingredient1) - burger.add_ingredient(ingredient2) + assert burger.ingredients == [ingredient2, ingredient1] - assert burger.get_price() == 400 # 100*2 + 50 + 150 + def test_get_price(self): + burger = Burger() + bun = Bun("black bun", 100) + burger.set_buns(bun) + burger.add_ingredient(Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 50)) + burger.add_ingredient(Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 150)) -def test_get_receipt(): - burger = Burger() - bun = Bun("black bun", 100) - burger.set_buns(bun) + assert burger.get_price() == 400 - ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 50) - burger.add_ingredient(ingredient) + def test_get_receipt(self): + burger = Burger() + bun = Bun("black bun", 100) + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 50) - receipt = burger.get_receipt() + burger.set_buns(bun) + burger.add_ingredient(ingredient) - assert "(==== black bun ====)" in receipt - assert "= sauce hot sauce =" in receipt - assert "Price: 250" in receipt + expected_receipt = ( + "(==== black bun ====)\n" + "= sauce hot sauce =\n" + "(==== black bun ====)\n" + "\n" + "Price: 250" + ) + + assert burger.get_receipt() == expected_receipt diff --git a/1_task/tests/test_database.py b/1_task/tests/test_database.py index d33fd119c..4c18eff0c 100644 --- a/1_task/tests/test_database.py +++ b/1_task/tests/test_database.py @@ -3,21 +3,23 @@ from praktikum.ingredient import Ingredient -def test_database_init(): - database = Database() - assert len(database.buns) == 3 - assert len(database.ingredients) == 6 +class TestDatabase: + def test_database_init(self): + database = Database() + assert len(database.buns) == 3 + assert len(database.ingredients) == 6 -def test_available_buns(): - database = Database() - buns = database.available_buns() - assert isinstance(buns, list) - assert all(isinstance(bun, Bun) for bun in buns) + def test_available_buns(self): + database = Database() + buns = database.available_buns() + assert isinstance(buns, list) + assert all(isinstance(bun, Bun) for bun in buns) -def test_available_ingredients(): - database = Database() - ingredients = database.available_ingredients() - assert isinstance(ingredients, list) - assert all(isinstance(ingredient, Ingredient) for ingredient in ingredients) + def test_available_ingredients(self): + database = Database() + ingredients = database.available_ingredients() + + assert isinstance(ingredients, list) + assert all(isinstance(ingredient, Ingredient) for ingredient in ingredients) diff --git a/1_task/tests/test_ingredient.py b/1_task/tests/test_ingredient.py index bd3bd99ff..42e9a64aa 100644 --- a/1_task/tests/test_ingredient.py +++ b/1_task/tests/test_ingredient.py @@ -2,23 +2,22 @@ from praktikum.ingredient_types import INGREDIENT_TYPE_SAUCE, INGREDIENT_TYPE_FILLING -def test_ingredient_init(): - ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) - assert ingredient.type == INGREDIENT_TYPE_SAUCE - assert ingredient.name == "hot sauce" - assert ingredient.price == 100 +class TestIngredient: + def test_ingredient_init(self): + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) + assert ingredient.type == INGREDIENT_TYPE_SAUCE + assert ingredient.name == "hot sauce" + assert ingredient.price == 100 -def test_get_price(): - ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) - assert ingredient.get_price() == 200 + def test_get_price(self): + ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) + assert ingredient.get_price() == 200 + def test_get_name(self): + ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "sausage", 300) + assert ingredient.get_name() == "sausage" -def test_get_name(): - ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "sausage", 300) - assert ingredient.get_name() == "sausage" - - -def test_get_type(): - ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "chili sauce", 150) - assert ingredient.get_type() == INGREDIENT_TYPE_SAUCE + def test_get_type(self): + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "chili sauce", 150) + assert ingredient.get_type() == INGREDIENT_TYPE_SAUCE From 75f786b2ead58df11dd09f5baa4aa52ba6c2d7c1 Mon Sep 17 00:00:00 2001 From: Vitaliy Gulevatiy Date: Sat, 7 Feb 2026 16:14:36 +0300 Subject: [PATCH 5/6] Add praktikum source code --- 1_task/praktikum/README.md | 24 ++++++++++++++ 1_task/praktikum/__init__.py | 0 1_task/praktikum/bun.py | 15 +++++++++ 1_task/praktikum/burger.py | 48 ++++++++++++++++++++++++++++ 1_task/praktikum/database.py | 33 +++++++++++++++++++ 1_task/praktikum/ingredient.py | 20 ++++++++++++ 1_task/praktikum/ingredient_types.py | 7 ++++ 1_task/praktikum/praktikum.py | 41 ++++++++++++++++++++++++ 8 files changed, 188 insertions(+) create mode 100644 1_task/praktikum/README.md create mode 100644 1_task/praktikum/__init__.py create mode 100644 1_task/praktikum/bun.py create mode 100644 1_task/praktikum/burger.py create mode 100644 1_task/praktikum/database.py create mode 100644 1_task/praktikum/ingredient.py create mode 100644 1_task/praktikum/ingredient_types.py create mode 100644 1_task/praktikum/praktikum.py diff --git a/1_task/praktikum/README.md b/1_task/praktikum/README.md new file mode 100644 index 000000000..272081708 --- /dev/null +++ b/1_task/praktikum/README.md @@ -0,0 +1,24 @@ +## Задание 1: Юнит-тесты + +### Автотесты для проверки программы, которая помогает заказать бургер в Stellar Burgers + +### Реализованные сценарии + +Созданы юнит-тесты, покрывающие классы `Bun`, `Burger`, `Ingredient`, `Database` + +Процент покрытия 100% (отчет: `htmlcov/index.html`) + +### Структура проекта + +- `praktikum` - пакет, содержащий код программы +- `tests` - пакет, содержащий тесты, разделенные по классам. Например, `bun_test.py`, `burger_test.py` и т.д. + +### Запуск автотестов + +**Установка зависимостей** + +> `$ pip install -r requirements.txt` + +**Запуск автотестов и создание HTML-отчета о покрытии** + +> `$ pytest --cov=praktikum --cov-report=html` diff --git a/1_task/praktikum/__init__.py b/1_task/praktikum/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/1_task/praktikum/bun.py b/1_task/praktikum/bun.py new file mode 100644 index 000000000..5504bc1f4 --- /dev/null +++ b/1_task/praktikum/bun.py @@ -0,0 +1,15 @@ +class Bun: + """ + Модель булочки для бургера. + Булочке можно дать название и назначить цену. + """ + + def __init__(self, name: str, price: float): + self.name = name + self.price = price + + def get_name(self) -> str: + return self.name + + def get_price(self) -> float: + return self.price diff --git a/1_task/praktikum/burger.py b/1_task/praktikum/burger.py new file mode 100644 index 000000000..2b3b6a88b --- /dev/null +++ b/1_task/praktikum/burger.py @@ -0,0 +1,48 @@ +from typing import List + +from praktikum.bun import Bun +from praktikum.ingredient import Ingredient + + +class Burger: + """ + Модель бургера. + Бургер состоит из булочек и ингредиентов (начинка или соус). + Ингредиенты можно перемещать и удалять. + Можно распечать чек с информацией о бургере. + """ + + def __init__(self): + self.bun = None + self.ingredients: List[Ingredient] = [] + + def set_buns(self, bun: Bun): + self.bun = bun + + def add_ingredient(self, ingredient: Ingredient): + self.ingredients.append(ingredient) + + def remove_ingredient(self, index: int): + del self.ingredients[index] + + def move_ingredient(self, index: int, new_index: int): + self.ingredients.insert(new_index, self.ingredients.pop(index)) + + def get_price(self) -> float: + price = self.bun.get_price() * 2 + + for ingredient in self.ingredients: + price += ingredient.get_price() + + return price + + def get_receipt(self) -> str: + receipt: List[str] = [f'(==== {self.bun.get_name()} ====)'] + + for ingredient in self.ingredients: + receipt.append(f'= {str(ingredient.get_type()).lower()} {ingredient.get_name()} =') + + receipt.append(f'(==== {self.bun.get_name()} ====)\n') + receipt.append(f'Price: {self.get_price()}') + + return '\n'.join(receipt) diff --git a/1_task/praktikum/database.py b/1_task/praktikum/database.py new file mode 100644 index 000000000..4c75baf71 --- /dev/null +++ b/1_task/praktikum/database.py @@ -0,0 +1,33 @@ +from typing import List + +from praktikum.bun import Bun +from praktikum.ingredient import Ingredient +from praktikum.ingredient_types import INGREDIENT_TYPE_SAUCE, INGREDIENT_TYPE_FILLING + + +class Database: + """ + Класс с методами по работе с базой данных. + """ + + def __init__(self): + self.buns: List[Bun] = [] + self.ingredients: List[Ingredient] = [] + + self.buns.append(Bun("black bun", 100)) + self.buns.append(Bun("white bun", 200)) + self.buns.append(Bun("red bun", 300)) + + self.ingredients.append(Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100)) + self.ingredients.append(Ingredient(INGREDIENT_TYPE_SAUCE, "sour cream", 200)) + self.ingredients.append(Ingredient(INGREDIENT_TYPE_SAUCE, "chili sauce", 300)) + + self.ingredients.append(Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 100)) + self.ingredients.append(Ingredient(INGREDIENT_TYPE_FILLING, "dinosaur", 200)) + self.ingredients.append(Ingredient(INGREDIENT_TYPE_FILLING, "sausage", 300)) + + def available_buns(self) -> List[Bun]: + return self.buns + + def available_ingredients(self) -> List[Ingredient]: + return self.ingredients diff --git a/1_task/praktikum/ingredient.py b/1_task/praktikum/ingredient.py new file mode 100644 index 000000000..0e50db8a2 --- /dev/null +++ b/1_task/praktikum/ingredient.py @@ -0,0 +1,20 @@ +class Ingredient: + """ + Модель ингредиента. + Ингредиент: начинка или соус. + У ингредиента есть тип (начинка или соус), название и цена. + """ + + def __init__(self, ingredient_type: str, name: str, price: float): + self.type = ingredient_type + self.name = name + self.price = price + + def get_price(self) -> float: + return self.price + + def get_name(self) -> str: + return self.name + + def get_type(self) -> str: + return self.type diff --git a/1_task/praktikum/ingredient_types.py b/1_task/praktikum/ingredient_types.py new file mode 100644 index 000000000..34940ad5d --- /dev/null +++ b/1_task/praktikum/ingredient_types.py @@ -0,0 +1,7 @@ +""" +Перечисление с типами ингредиентов. +SAUCE – соус +FILLING – начинка +""" +INGREDIENT_TYPE_SAUCE = 'SAUCE' +INGREDIENT_TYPE_FILLING = 'FILLING' diff --git a/1_task/praktikum/praktikum.py b/1_task/praktikum/praktikum.py new file mode 100644 index 000000000..ec522fa6d --- /dev/null +++ b/1_task/praktikum/praktikum.py @@ -0,0 +1,41 @@ +from typing import List + +from praktikum.bun import Bun +from praktikum.burger import Burger +from praktikum.database import Database +from praktikum.ingredient import Ingredient + + +def main(): + # Инициализируем базу данных + database: Database = Database() + + # Создадим новый бургер + burger: Burger = Burger() + + # Считаем список доступных булок из базы данных + buns: List[Bun] = database.available_buns() + + # Считаем список доступных ингредиентов из базы данных + ingredients: List[Ingredient] = database.available_ingredients() + + # Соберём бургер + burger.set_buns(buns[0]) + + burger.add_ingredient(ingredients[1]) + burger.add_ingredient(ingredients[4]) + burger.add_ingredient(ingredients[3]) + burger.add_ingredient(ingredients[5]) + + # Переместим слой с ингредиентом + burger.move_ingredient(2, 1) + + # Удалим ингредиент + burger.remove_ingredient(3) + + # Распечатаем рецепт бургера + print(burger.get_receipt()) + + +if __name__ == "__main__": + main() From 44081b547daea80f742c6b830df8559b0d50da53 Mon Sep 17 00:00:00 2001 From: Vitaliy Gulevatiy Date: Sun, 8 Feb 2026 17:49:54 +0300 Subject: [PATCH 6/6] fix: refactor unit tests and test data for task 1 --- 1_task/.idea/1_task.iml | 12 --- .../inspectionProfiles/profiles_settings.xml | 6 -- 1_task/.idea/misc.xml | 7 -- 1_task/.idea/modules.xml | 8 -- 1_task/.idea/vcs.xml | 6 -- 1_task/.idea/workspace.xml | 54 ------------- 1_task/tests/data/__init__.py | 0 1_task/tests/data/test_data.py | 28 +++++++ 1_task/tests/test_bun.py | 26 +++++-- 1_task/tests/test_burger.py | 76 ++++++++++++++----- 1_task/tests/test_ingredient.py | 48 +++++++++--- 11 files changed, 142 insertions(+), 129 deletions(-) delete mode 100644 1_task/.idea/1_task.iml delete mode 100644 1_task/.idea/inspectionProfiles/profiles_settings.xml delete mode 100644 1_task/.idea/misc.xml delete mode 100644 1_task/.idea/modules.xml delete mode 100644 1_task/.idea/vcs.xml delete mode 100644 1_task/.idea/workspace.xml create mode 100644 1_task/tests/data/__init__.py create mode 100644 1_task/tests/data/test_data.py diff --git a/1_task/.idea/1_task.iml b/1_task/.idea/1_task.iml deleted file mode 100644 index f55cd921e..000000000 --- a/1_task/.idea/1_task.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/1_task/.idea/inspectionProfiles/profiles_settings.xml b/1_task/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2da2..000000000 --- a/1_task/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/1_task/.idea/misc.xml b/1_task/.idea/misc.xml deleted file mode 100644 index 590a59e60..000000000 --- a/1_task/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/1_task/.idea/modules.xml b/1_task/.idea/modules.xml deleted file mode 100644 index fe0b02624..000000000 --- a/1_task/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/1_task/.idea/vcs.xml b/1_task/.idea/vcs.xml deleted file mode 100644 index 5c4e74dbb..000000000 --- a/1_task/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/1_task/.idea/workspace.xml b/1_task/.idea/workspace.xml deleted file mode 100644 index 6bdc03058..000000000 --- a/1_task/.idea/workspace.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - 1769188965711 - - - - \ No newline at end of file diff --git a/1_task/tests/data/__init__.py b/1_task/tests/data/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/1_task/tests/data/test_data.py b/1_task/tests/data/test_data.py new file mode 100644 index 000000000..5bcba71b7 --- /dev/null +++ b/1_task/tests/data/test_data.py @@ -0,0 +1,28 @@ +# buns +BLACK_BUN_NAME = "black bun" +BLACK_BUN_PRICE = 100 + +WHITE_BUN_NAME = "white bun" +WHITE_BUN_PRICE = 200 + +RED_BUN_NAME = "red bun" +RED_BUN_PRICE = 300 + +# ingredients +HOT_SAUCE_NAME = "hot sauce" +HOT_SAUCE_PRICE = 50 + +CUTLET_NAME = "cutlet" +CUTLET_PRICE = 200 + +SAUSAGE_NAME = "sausage" +SAUSAGE_PRICE = 300 + +# receipt +EXPECTED_RECEIPT_SINGLE_SAUCE = ( + "(==== black bun ====)\n" + "= sauce hot sauce =\n" + "(==== black bun ====)\n" + "\n" + "Price: 250" +) diff --git a/1_task/tests/test_bun.py b/1_task/tests/test_bun.py index 64fd3b085..a17d7036f 100644 --- a/1_task/tests/test_bun.py +++ b/1_task/tests/test_bun.py @@ -1,16 +1,28 @@ from praktikum.bun import Bun +from tests.data.test_data import ( + BLACK_BUN_NAME, + BLACK_BUN_PRICE, + WHITE_BUN_NAME, + WHITE_BUN_PRICE, + RED_BUN_NAME, + RED_BUN_PRICE +) + + class TestBun: + def test_bun_init(self): - bun = Bun("black bun", 100) - assert bun.name == "black bun" - assert bun.price == 100 + bun = Bun(BLACK_BUN_NAME, BLACK_BUN_PRICE) + + assert bun.name == BLACK_BUN_NAME + assert bun.price == BLACK_BUN_PRICE def test_get_name(self): - bun = Bun("white bun", 200) - assert bun.get_name() == "white bun" + bun = Bun(WHITE_BUN_NAME, WHITE_BUN_PRICE) + assert bun.get_name() == WHITE_BUN_NAME def test_get_price(self): - bun = Bun("red bun", 300) - assert bun.get_price() == 300 + bun = Bun(RED_BUN_NAME, RED_BUN_PRICE) + assert bun.get_price() == RED_BUN_PRICE diff --git a/1_task/tests/test_burger.py b/1_task/tests/test_burger.py index 832b326c1..c61984057 100644 --- a/1_task/tests/test_burger.py +++ b/1_task/tests/test_burger.py @@ -6,11 +6,22 @@ INGREDIENT_TYPE_FILLING ) +from tests.data.test_data import ( + BLACK_BUN_NAME, + BLACK_BUN_PRICE, + HOT_SAUCE_NAME, + HOT_SAUCE_PRICE, + CUTLET_NAME, + CUTLET_PRICE, + EXPECTED_RECEIPT_SINGLE_SAUCE +) + class TestBurger: + def test_set_buns(self): burger = Burger() - bun = Bun("black bun", 100) + bun = Bun(BLACK_BUN_NAME, BLACK_BUN_PRICE) burger.set_buns(bun) @@ -18,7 +29,11 @@ def test_set_buns(self): def test_add_ingredient(self): burger = Burger() - ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) + ingredient = Ingredient( + INGREDIENT_TYPE_SAUCE, + HOT_SAUCE_NAME, + HOT_SAUCE_PRICE + ) burger.add_ingredient(ingredient) @@ -26,7 +41,11 @@ def test_add_ingredient(self): def test_remove_ingredient(self): burger = Burger() - ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) + ingredient = Ingredient( + INGREDIENT_TYPE_FILLING, + CUTLET_NAME, + CUTLET_PRICE + ) burger.add_ingredient(ingredient) burger.remove_ingredient(0) @@ -35,8 +54,17 @@ def test_remove_ingredient(self): def test_move_ingredient(self): burger = Burger() - ingredient1 = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) - ingredient2 = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) + + ingredient1 = Ingredient( + INGREDIENT_TYPE_SAUCE, + HOT_SAUCE_NAME, + HOT_SAUCE_PRICE + ) + ingredient2 = Ingredient( + INGREDIENT_TYPE_FILLING, + CUTLET_NAME, + CUTLET_PRICE + ) burger.add_ingredient(ingredient1) burger.add_ingredient(ingredient2) @@ -46,28 +74,36 @@ def test_move_ingredient(self): def test_get_price(self): burger = Burger() - bun = Bun("black bun", 100) + bun = Bun(BLACK_BUN_NAME, BLACK_BUN_PRICE) burger.set_buns(bun) - burger.add_ingredient(Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 50)) - burger.add_ingredient(Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 150)) + burger.add_ingredient( + Ingredient( + INGREDIENT_TYPE_SAUCE, + HOT_SAUCE_NAME, + HOT_SAUCE_PRICE + ) + ) + burger.add_ingredient( + Ingredient( + INGREDIENT_TYPE_FILLING, + CUTLET_NAME, + CUTLET_PRICE + ) + ) - assert burger.get_price() == 400 + assert burger.get_price() == 450 def test_get_receipt(self): burger = Burger() - bun = Bun("black bun", 100) - ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 50) + bun = Bun(BLACK_BUN_NAME, BLACK_BUN_PRICE) + ingredient = Ingredient( + INGREDIENT_TYPE_SAUCE, + HOT_SAUCE_NAME, + HOT_SAUCE_PRICE + ) burger.set_buns(bun) burger.add_ingredient(ingredient) - expected_receipt = ( - "(==== black bun ====)\n" - "= sauce hot sauce =\n" - "(==== black bun ====)\n" - "\n" - "Price: 250" - ) - - assert burger.get_receipt() == expected_receipt + assert burger.get_receipt() == EXPECTED_RECEIPT_SINGLE_SAUCE diff --git a/1_task/tests/test_ingredient.py b/1_task/tests/test_ingredient.py index 42e9a64aa..5feed1f97 100644 --- a/1_task/tests/test_ingredient.py +++ b/1_task/tests/test_ingredient.py @@ -1,23 +1,53 @@ from praktikum.ingredient import Ingredient -from praktikum.ingredient_types import INGREDIENT_TYPE_SAUCE, INGREDIENT_TYPE_FILLING +from praktikum.ingredient_types import ( + INGREDIENT_TYPE_SAUCE, + INGREDIENT_TYPE_FILLING +) + +from tests.data.test_data import ( + HOT_SAUCE_NAME, + HOT_SAUCE_PRICE, + CUTLET_NAME, + CUTLET_PRICE, + SAUSAGE_NAME, + SAUSAGE_PRICE +) + class TestIngredient: + def test_ingredient_init(self): - ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "hot sauce", 100) + ingredient = Ingredient( + INGREDIENT_TYPE_SAUCE, + HOT_SAUCE_NAME, + HOT_SAUCE_PRICE + ) assert ingredient.type == INGREDIENT_TYPE_SAUCE - assert ingredient.name == "hot sauce" - assert ingredient.price == 100 + assert ingredient.name == HOT_SAUCE_NAME + assert ingredient.price == HOT_SAUCE_PRICE def test_get_price(self): - ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "cutlet", 200) - assert ingredient.get_price() == 200 + ingredient = Ingredient( + INGREDIENT_TYPE_FILLING, + CUTLET_NAME, + CUTLET_PRICE + ) + assert ingredient.get_price() == CUTLET_PRICE def test_get_name(self): - ingredient = Ingredient(INGREDIENT_TYPE_FILLING, "sausage", 300) - assert ingredient.get_name() == "sausage" + ingredient = Ingredient( + INGREDIENT_TYPE_FILLING, + SAUSAGE_NAME, + SAUSAGE_PRICE + ) + assert ingredient.get_name() == SAUSAGE_NAME def test_get_type(self): - ingredient = Ingredient(INGREDIENT_TYPE_SAUCE, "chili sauce", 150) + ingredient = Ingredient( + INGREDIENT_TYPE_SAUCE, + HOT_SAUCE_NAME, + HOT_SAUCE_PRICE + ) assert ingredient.get_type() == INGREDIENT_TYPE_SAUCE