Compare commits

...

1 Commits

Author SHA1 Message Date
dev-runner cb98e2fa75 [writer] план helloworld (конвейер DevHub) 2026-10-19 15:05:07 +05:00
1 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,90 @@
# План приложения helloworld
## Структура проекта
```
helloworld/
├── src/
│ └── main.py
├── tests/
│ └── test_main.py
├── .gitignore
├── README.md
└── requirements.txt
```
## Файлы
1. **src/main.py**
```python
def say_hello():
return "Hello, World!"
if __name__ == "__main__":
print(say_hello())
```
2. **tests/test_main.py**
```python
import unittest
from src.main import say_hello
class TestMain(unittest.TestCase):
def test_say_hello(self):
self.assertEqual(say_hello(), "Hello, World!")
if __name__ == "__main__":
unittest.main()
```
3. **.gitignore**
```
/tests/__pycache__/
```
4. **README.md**
```markdown
# helloworld
Простое приложение на Python, выводящее "Hello, World!".
```
5. **requirements.txt**
```
# No external dependencies required
```
## Шаги сборки
1. Создайте новый каталог для проекта `helloworld`.
2. Создайте файл `src/main.py` и вставьте в него код:
```python
def say_hello():
return "Hello, World!"
if __name__ == "__main__":
print(say_hello())
```
3. Создайте каталог `tests` и файл `tests/test_main.py` с кодом:
```python
import unittest
from src.main import say_hello
class TestMain(unittest.TestCase):
def test_say_hello(self):
self.assertEqual(say_hello(), "Hello, World!")
if __name__ == "__main__":
unittest.main()
```
4. Создайте файл `.gitignore` с содержимым:
```
/tests/__pycache__/
```
5. Создайте файл `README.md` с содержимым:
```markdown
# helloworld
Простое приложение на Python, выводящее "Hello, World!".
```
6. Создайте файл `requirements.txt` и оставьте его пустым, так как нет внешних зависимостей.
7. В терминале перейдите в каталог `helloworld` и выполните команду `python -m unittest tests/test_main.py` для запуска тестов.
8. Если тесты прошли успешно, приложение готово к использованию.