Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
63e4196
__init__.py - Пустой файл для маркировки директории как пакета
AlexandraRozhneva Jul 29, 2026
95c4709
conftest.py - фикстуры
AlexandraRozhneva Jul 29, 2026
9a3bd0c
test_burger.py - тесты для класса Burger
AlexandraRozhneva Jul 29, 2026
3fe5dd8
conftest.py - фикстуры
AlexandraRozhneva Jul 29, 2026
04fbe9c
test_burger.py - тесты для класса Burger
AlexandraRozhneva Jul 29, 2026
c710b24
conftest.py - фикстуры
AlexandraRozhneva Jul 29, 2026
b5a3fb5
test_burger.py - тесты для класса Burger
AlexandraRozhneva Jul 29, 2026
cdf072e
conftest.py - фикстуры
AlexandraRozhneva Jul 29, 2026
c1e429b
test_burger.py - тесты для класса Burger
AlexandraRozhneva Jul 29, 2026
4fce155
conftest.py
AlexandraRozhneva Jul 29, 2026
d69eefb
test_burger.py
AlexandraRozhneva Jul 29, 2026
3039855
__init__.py
AlexandraRozhneva Jul 29, 2026
a140277
test_burger.py
AlexandraRozhneva Jul 29, 2026
473ede7
conftest.py
AlexandraRozhneva Jul 29, 2026
9b15a23
burger.py
AlexandraRozhneva Jul 29, 2026
0aadfad
database.py
AlexandraRozhneva Jul 29, 2026
fb57221
praktikum.py
AlexandraRozhneva Jul 29, 2026
fb02429
.gitignore
AlexandraRozhneva Jul 29, 2026
13f283e
requirements.txt
AlexandraRozhneva Jul 29, 2026
1da1c8e
pytest.ini - для правильной конфигурации
AlexandraRozhneva Aug 3, 2026
edfaaa5
.gitignore
AlexandraRozhneva Aug 3, 2026
c990f85
conftest.py - Добавлена настройка PYTHONPATH
AlexandraRozhneva Aug 3, 2026
1e8d365
test_burger.py - Добавлена настройка PYTHONPATH, на каждый метод - от…
AlexandraRozhneva Aug 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__pycache__
.coverage
coverage.json
4 changes: 2 additions & 2 deletions burger.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import List

from praktikum.bun import Bun
from praktikum.ingredient import Ingredient
from bun import Bun
from ingredient import Ingredient


class Burger:
Expand Down
6 changes: 3 additions & 3 deletions database.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
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
from bun import Bun
from ingredient import Ingredient
from ingredient_types import INGREDIENT_TYPE_SAUCE, INGREDIENT_TYPE_FILLING


class Database:
Expand Down
8 changes: 4 additions & 4 deletions praktikum.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import List

from praktikum.bun import Bun
from praktikum.burger import Burger
from praktikum.database import Database
from praktikum.ingredient import Ingredient
from bun import Bun
from burger import Burger
from database import Database
from ingredient import Ingredient


def main():
Expand Down
6 changes: 6 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[pytest]
pythonpath = .
testpaths = unit_tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
Binary file added requirements.txt
Binary file not shown.
Empty file added unit_tests/__init__.py
Empty file.
56 changes: 56 additions & 0 deletions unit_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import sys
import os
from pathlib import Path

# Добавляем корневую директорию в PYTHONPATH
root_dir = str(Path(__file__).parent.parent)
sys.path.insert(0, root_dir)

import pytest
from unittest.mock import Mock
from burger import Burger


@pytest.fixture
def burger():
"""Фикстура для создания бургера"""
return Burger()


@pytest.fixture
def mock_bun():
"""Фикстура для создания мока булочки"""
mock = Mock()
mock.get_name.return_value = "test bun"
mock.get_price.return_value = 100.0
return mock


@pytest.fixture
def mock_ingredient_sauce():
"""Фикстура для создания мока соуса"""
mock = Mock()
mock.get_type.return_value = "SAUCE"
mock.get_name.return_value = "test sauce"
mock.get_price.return_value = 50.0
return mock


@pytest.fixture
def mock_ingredient_filling():
"""Фикстура для создания мока начинки"""
mock = Mock()
mock.get_type.return_value = "FILLING"
mock.get_name.return_value = "test filling"
mock.get_price.return_value = 75.0
return mock


@pytest.fixture
def mock_ingredient_extra():
"""Фикстура для создания дополнительного мока ингредиента"""
mock = Mock()
mock.get_type.return_value = "SAUCE"
mock.get_name.return_value = "extra sauce"
mock.get_price.return_value = 25.0
return mock
Loading