From df43f82b5aa0afbbe2800b98e5803a50575fb5f7 Mon Sep 17 00:00:00 2001 From: elizabeth-af Date: Sun, 26 Jul 2026 22:00:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B2=D0=BE=D0=B5=20=D0=B4?= =?UTF-8?q?=D0=B8=D0=BF=D0=BB=D0=BE=D0=BC=D0=BD=D0=BE=D0=B5=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py => praktikum/__init__.py | 0 bun.py => praktikum/bun.py | 0 burger.py => praktikum/burger.py | 0 database.py => praktikum/database.py | 0 ingredient.py => praktikum/ingredient.py | 0 .../ingredient_types.py | 0 requirements.txt | Bin 0 -> 1154 bytes tests/__init__.py | 0 tests/__pycache__/__init__.cpython-314.pyc | Bin 0 -> 138 bytes .../test__bun.cpython-314-pytest-9.0.3.pyc | Bin 0 -> 2799 bytes .../test_bun.cpython-314-pytest-9.0.3.pyc | Bin 0 -> 2756 bytes .../test_burger.cpython-314-pytest-9.0.3.pyc | Bin 0 -> 8754 bytes ...test_database.cpython-314-pytest-9.0.3.pyc | Bin 0 -> 3032 bytes ...st_ingredient.cpython-314-pytest-9.0.3.pyc | Bin 0 -> 4457 bytes tests/test_bun.py | 12 +++ tests/test_burger.py | 69 ++++++++++++++++++ tests/test_database.py | 26 +++++++ tests/test_ingredient.py | 28 +++++++ 18 files changed, 135 insertions(+) rename __init__.py => praktikum/__init__.py (100%) rename bun.py => praktikum/bun.py (100%) rename burger.py => praktikum/burger.py (100%) rename database.py => praktikum/database.py (100%) rename ingredient.py => praktikum/ingredient.py (100%) rename ingredient_types.py => praktikum/ingredient_types.py (100%) create mode 100644 requirements.txt create mode 100644 tests/__init__.py create mode 100644 tests/__pycache__/__init__.cpython-314.pyc create mode 100644 tests/__pycache__/test__bun.cpython-314-pytest-9.0.3.pyc create mode 100644 tests/__pycache__/test_bun.cpython-314-pytest-9.0.3.pyc create mode 100644 tests/__pycache__/test_burger.cpython-314-pytest-9.0.3.pyc create mode 100644 tests/__pycache__/test_database.cpython-314-pytest-9.0.3.pyc create mode 100644 tests/__pycache__/test_ingredient.cpython-314-pytest-9.0.3.pyc create mode 100644 tests/test_bun.py create mode 100644 tests/test_burger.py create mode 100644 tests/test_database.py create mode 100644 tests/test_ingredient.py diff --git a/__init__.py b/praktikum/__init__.py similarity index 100% rename from __init__.py rename to praktikum/__init__.py diff --git a/bun.py b/praktikum/bun.py similarity index 100% rename from bun.py rename to praktikum/bun.py diff --git a/burger.py b/praktikum/burger.py similarity index 100% rename from burger.py rename to praktikum/burger.py diff --git a/database.py b/praktikum/database.py similarity index 100% rename from database.py rename to praktikum/database.py diff --git a/ingredient.py b/praktikum/ingredient.py similarity index 100% rename from ingredient.py rename to praktikum/ingredient.py diff --git a/ingredient_types.py b/praktikum/ingredient_types.py similarity index 100% rename from ingredient_types.py rename to praktikum/ingredient_types.py diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..913953879077369713c1b541334ee4919fbb5114 GIT binary patch literal 1154 zcmZ`(T~ES55Zq@Ie+q~OtFD_faJBWLOG>45tkuDMJllO^smxt1&WtGkjQd(0MiuW|9);h*UaxNWKuH%r(B z_O_^ddB)4O&%l6P3%usI$e}=e=peJmu8;~0iN6KT1Uv%1)ymq-Me&K7_lT<=FF*ly zI_+f#F}ZV@I*vN+q{KTrZc)wT26tn%#`H_tuuz12q+EsWOecvw*3`=eOr6%qEW>7= z)8kjKs_yl?rFPH}c9|am&UL-=#*2DdeF`^&I%&NPb`;>qGY~uCQC~Ylqe&=HIqNQB z4c;>w1u&z+ZDMTr_o$apa0~1%c}(oVA@)3g6?s@jxWlyMnSbVQg(|0WRb*VXyd9N; z%|}g`HtseR9WVD z*h^efh}rizeN0$B+7@dQIRWtr^QID$9Q!k98NKSDWYhcjh>3S)!Y7X#;uFZ-meR=J z0=7<>5|!TA6J`qYe}Ml79t?8b%Z=36=6`de59~MBiAhJzH>z|3qXwt}JHM-Fnfn4} CzNnV~ literal 0 HcmV?d00001 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/__pycache__/__init__.cpython-314.pyc b/tests/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6edee8c811d933fcd586cd9eb9a07cc487e0eb5a GIT binary patch literal 138 zcmdPq)bNi8lZj){-Y%*!l^kJl@xyv1RYo1apelWJGQ3e*QOxfsOw N#LURZSi}ru0RZf09ee-) literal 0 HcmV?d00001 diff --git a/tests/__pycache__/test__bun.cpython-314-pytest-9.0.3.pyc b/tests/__pycache__/test__bun.cpython-314-pytest-9.0.3.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4362d7ca7d750e6d1a8e4c0088a27ea87082d3dc GIT binary patch literal 2799 zcmeHJ&2Jk;6rcUDy>=2uX-U(nlsE|qu^QZ@F>ON$3KT>t(I{FKb1@lh>`l64?cL0d z1%af^0f|&SfH-l?HUCZ9lopLZoViu_P?Qtz&F(szLZ~=!L5%D-@4flWn>TM~-kbCJ zo*aSp;f<9~%L*Yi6yl~wOnVNPZL&m6wIM7^G#&+yD3=_f

B2rz?bKOdXAi%uPGsXfQT{mb&1t5n{B5!G~>9?TndZsUG{~D-~ri@)0M+ZGCu% zlq12{OtOBhqFsVSV7adHHZWNt5$#fM2GT*wJ6()p#9K ze<4=uU{f!|>M{0$K9Pu}pElEGrjov(9MNW~eepgLmQTdG!ya~+i7m(dEyXmhD!vMT z?W)3Vng$%Bu7m8dYt_~Y%dMu+{EbPWMchRc%SbLCC`;gnO0i9TAhT$eK2XEm?kTg(>SFie+Qj?0~9AkwY}h(MgC!7Z=l)+Lm#y56$o z$^}K12G)v=7DWCXxg*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P zau5XVJFyzuB>Ng^SE3H^_brkh*tcxW&TI>2oQV-19srME5*T2yMIU zFzOf>q>XgXIvHC(I@U;!Z4&F(gpza*&+-IXCrjlK8MAYbQ5!59*7&wWg`-aI(A1sf zT|xphnGt&cJMsyGDC}KO6eFf6OV#;$S%q{$QI_k4GQK5{ODoDkiE4VeR8cEcMWH?T z0EbYVM)7MDGbk>DFgg@P(_sUys1$Uamaf;~8A31Zic&0tn=)T2>O~cH0u|WzPr3@B z8E$@m%$_{OpcE4kNN5;S`}dddTwh31sQX1i3JtwTL_#Akc0@vF#1}i_q3n-)+e72e z1rTg{tZjCOLG1lS7RWdDDCUl2zv(c+E@3}aKcgibb{Bb(5wXhHdv7G`m6DDxV*e8S z`vPSiUmNTK-qcGs>r1d9iaUPn3p0}L;)=N^y3;9hqH`4YA&k9#RSJHH8r!2VqlD~M zT*do=fpYW1Aipvn)<<*!%J9Bv_*9+;MN#}-5WW!pDI9zz^gI&|JQMo97q0#&eI$;* J6hN>}{s&aV`zinc literal 0 HcmV?d00001 diff --git a/tests/__pycache__/test_database.cpython-314-pytest-9.0.3.pyc b/tests/__pycache__/test_database.cpython-314-pytest-9.0.3.pyc new file mode 100644 index 0000000000000000000000000000000000000000..60a31c5cbd7ce89428da4bc989c629a649da006a GIT binary patch literal 3032 zcmeHJ+iw(A7(a8_-I?9eEzlcM*sWk;BiT~A5Cn^uf+;bUW`b*CR!*kVX*)7|;mldF zeS*Zqz8a%G`fA_wPvAc&X%sop_~ZjmlrCYFC%^AZXLnjJ@eg2<`OP`s`F)pj`@VU- zcVC*o^Od#uaZV$|!A|t(JB`+5Xxt??iKSd4T#;XOMr*1$GNbcE4oB2$$(a;S<;VaT zC6+csEWM6MW%E}xt_CB3) zwXF7$_hGh0(p29$K*;UMxx`*JArXI8eYc+wlN==ty`dF}mAbCnzEMt`p8?Iq6FZ7a zKM*oPD#^&soDsFUUsy+@oSalF^Mk9CYH4RTEX7hQa?g-C*VE-kt_Z-8j&$R1C< z5wH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7?@3WR*1dP4jF_}CwC6b2vM;XL^|v)|+($4k)#u5mvA@rLj_NF7CIT^@-W ztY>8EzVJ*O8;c7oSD85(H{>rZrDKeH4%jA8EYtb8kyy|P-!1Z;vvK)O$C&9n6gT2B zW*dP@wg;6jRhJ3uIW33jVJ)947B#F_alTTj=CDqq(5>C76^f)#HfXR|0S|+o(2U!a zT5*oMY7526tz1zn=Sn&aYesHfXCu(&%RHk(rJTaJg6UChzJg0RqUm2$i@9=+Ku=tv zenT(L^EJS1Khp?%qPZCT-o~J}alveu0}gu|qXye|r%!kAizde3$yRYLPYU^3DSM?* zEmlfef0kuzaH+ZPB~e|bJ$xqSMm}cS-1~EoC;<{h3yagL z1Xzq!f!bi6Hy~3NXvV(R?*L~_N|T!4+=kto3Zga?)2N->0b-4OCUCs z{%y(nZA#D$@Nq4s&TwPd9!mXo>k;$rGJCc>k)W@IodB-_5%?5L@byz>cHn=?z(T|2 zEe!uNl)k(M;fzyZ@ZlQqfp^fM z=T#;zj$>eZ0V29LlG&O(hUnl@j+1}PTG zdbtAKL9^7Q{!$Jv(g+l|fLekJD>^?4Fe_1T7ZV9420+l5rWpik)x4G?;CibDF9L=- ztZDfoRH<`?Jjv@&G;8ozyvbvPFjg^L;&jLC2-iJJ7Zf zXxoumpF}%%qTRazUs&D?1cSlfo5jG$o&wq~)Bcdfz`#=weY*$*Uk*NMyopM7k&JKgR_ECAwpxAjk zr^+fTb9(%6lioF7(R(-r9c*0;c5v?c1VMO=&^PGore9I-V|4v#FedcvArL(JZ~pde AD*ylh literal 0 HcmV?d00001 diff --git a/tests/test_bun.py b/tests/test_bun.py new file mode 100644 index 000000000..cb69040d9 --- /dev/null +++ b/tests/test_bun.py @@ -0,0 +1,12 @@ +from praktikum.bun import Bun + + +class TestBun: + + def test_return_bun_name(self): + bun = Bun("black bun", 100) + assert bun.get_name() == "black bun" + + def test_return_bun_price(self): + bun = Bun("black bun", 100) + assert bun.get_price() == 100 \ No newline at end of file diff --git a/tests/test_burger.py b/tests/test_burger.py new file mode 100644 index 000000000..f49e1a6ec --- /dev/null +++ b/tests/test_burger.py @@ -0,0 +1,69 @@ +from unittest.mock import Mock +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 + +class TestBurger: + + def test_set_buns(self): + burger = Burger() + bun = Bun("black bun", 100) + burger.set_buns(bun) + assert burger.bun == bun + + def test_add_ingredient_to_list(self): + burger = Burger() + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE,"hot sauce",100) + burger.add_ingredient(ingredient) + assert burger.ingredients == [ingredient] + + def test_remove_ingredient_from_list(self): + burger = Burger() + ingredient_1 = Ingredient(INGREDIENT_TYPE_SAUCE,"hot sauce",100) + ingredient_2 = Ingredient(INGREDIENT_TYPE_FILLING,"cutlet",200) + burger.add_ingredient(ingredient_1) + burger.add_ingredient(ingredient_2) + burger.remove_ingredient(0) + assert burger.ingredients == [ingredient_2] + + def test_move_ingredient(self): + burger = Burger() + ingredient_1 = Ingredient(INGREDIENT_TYPE_SAUCE,"hot sauce",100) + ingredient_2 = Ingredient(INGREDIENT_TYPE_FILLING,"cutlet",200) + burger.add_ingredient(ingredient_1) + burger.add_ingredient(ingredient_2) + burger.move_ingredient(0, 1) + assert burger.ingredients == [ingredient_2, ingredient_1] + + def test_get_total_price(self): + burger = Burger() + bun = Mock() + bun.get_price.return_value = 100 + ingredient_1 = Mock() + ingredient_1.get_price.return_value = 100 + ingredient_2 = Mock() + ingredient_2.get_price.return_value = 200 + burger.set_buns(bun) + burger.add_ingredient(ingredient_1) + burger.add_ingredient(ingredient_2) + assert burger.get_price() == 500 + + def test_get_receipt(self): + burger = Burger() + bun = Mock() + bun.get_name.return_value = "black bun" + bun.get_price.return_value = 100 + ingredient = Mock() + ingredient.get_name.return_value = "hot sauce" + ingredient.get_type.return_value = "SAUCE" + ingredient.get_price.return_value = 100 + burger.set_buns(bun) + burger.add_ingredient(ingredient) + expected_receipt = ( + "(==== black bun ====)\n" + "= sauce hot sauce =\n" + "(==== black bun ====)\n\n" + "Price: 300" + ) + assert burger.get_receipt() == expected_receipt \ No newline at end of file diff --git a/tests/test_database.py b/tests/test_database.py new file mode 100644 index 000000000..1b6af1ec6 --- /dev/null +++ b/tests/test_database.py @@ -0,0 +1,26 @@ +from praktikum.database import Database + +class TestDatabase: + + def test_available_buns_returns_all_buns(self): + database = Database() + buns = database.available_buns() + bun_names = [bun.get_name() for bun in buns] + assert bun_names == [ + "black bun", + "white bun", + "red bun" + ] + + def test_available_ingredients_returns_all_ingredients(self): + database = Database() + ingredients = database.available_ingredients() + ingredient_names = [ingredient.get_name()for ingredient in ingredients] + assert ingredient_names == [ + "hot sauce", + "sour cream", + "chili sauce", + "cutlet", + "dinosaur", + "sausage" + ] \ No newline at end of file diff --git a/tests/test_ingredient.py b/tests/test_ingredient.py new file mode 100644 index 000000000..daf9d05e5 --- /dev/null +++ b/tests/test_ingredient.py @@ -0,0 +1,28 @@ +import pytest + +from praktikum.ingredient import Ingredient +from praktikum.ingredient_types import INGREDIENT_TYPE_SAUCE, INGREDIENT_TYPE_FILLING + + +class TestIngredient: + + @pytest.mark.parametrize( + "ingredient_type", + [ + INGREDIENT_TYPE_SAUCE, + INGREDIENT_TYPE_FILLING + ] + ) + def test_get_type_returns_ingredient_type(self, ingredient_type): + ingredient = Ingredient(ingredient_type, "ketchup", 50) + assert ingredient.get_type() == ingredient_type + + + def test_get_name_returns_ingredient_name(self): + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE,"ketchup",50) + assert ingredient.get_name() == "ketchup" + + + def test_get_price_returns_ingredient_price(self): + ingredient = Ingredient(INGREDIENT_TYPE_SAUCE,"ketchup",50) + assert ingredient.get_price() == 50 \ No newline at end of file