PIUnit


NamePIUnit JSON
Version 1.0.5 PyPI version JSON
download
home_pagehttps://github.com/Ryize/PIUnit
SummaryLibrary for convenient code testing with print and input functions
upload_time2024-09-13 15:11:02
maintainerNone
docs_urlNone
authorMChekashov
requires_python>=3.7
licenseNone
keywords python test unittest print input
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PIUnit

Добавляет возможность тестировать код с функциями print и input
<br>

Установите библиотеку:
```
pip install piunit
```

<br>

Пример использования:
```
from main import print_hello_world, log_user_state, get_data
from piunit.test import BasePIUnitTest


class TestOne(BasePIUnitTest):
    def test_one(self):
        self.assertPrint(print_hello_world, ['Hello, World!'])
        self.assertInput(log_user_state, ['Смена пароля', 'Пароль успешно изменён'], True, 'new_pass')
        self.assertPrintInput(get_data, [10, 3, 2], ['Результат выполнения кода: 15'])
```

Описание методов класса BasePIUnitTest:
<pre>
+ assertPrint(test_func: Callable, prints: SupportsIndex,
                   all_: bool = False)
  Тестирует код с функцией print.
    Проверяет, напечаталось ли в print то, что ожидалось.
    Args:
      test_func: Callable (тестируемый объект)
      prints: SupportsIndex (значения для print)
      all_: bool (при True - вернёт ошибку если остались неиспользованные
        значения)
      *args, **kwargs: аргументы для тестируемой функции


+ assertInput(test_func: Callable, inputs: SupportsIndex,
                   all_: bool = False)

  Тестирует код с функцией input.
  Возвращает указанные данные при вызове input.

  Args:
    test_func: Callable (тестируемый объект)
    inputs: SupportsIndex (значения для input)
    all_: bool (при True, вернёт ошибку если остались неиспользованные
    значения)
    *args, **kwargs: аргументы для тестируемой функции


+ assertPrintInput(self, test_func: Callable,
                         inputs: SupportsIndex,
                         prints: SupportsIndex,
                         all_: bool = False
                         ):

  Тестирует код с функцией print и input.

  Подставляет по порядку данные из prints и inputs.

  Args:
    test_func: Callable (тестируемый объект)
    inputs: SupportsIndex (значения для input)
    prints: SupportsIndex (значения для print)
    all_: bool (при True, вернёт ошибку если остались неиспользованные
    значения)
    *args, **kwargs: аргументы для тестируемой функции
</pre>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Ryize/PIUnit",
    "name": "PIUnit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "python test unittest print input",
    "author": "MChekashov",
    "author_email": "chekashovmatvey@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/42/e4/654a4ccdcc24605897bfa5cb66940d4d4673861086c68fb634ebced46d50/piunit-1.0.5.tar.gz",
    "platform": null,
    "description": "# PIUnit\n\n\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 print \u0438 input\n<br>\n\n\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:\n```\npip install piunit\n```\n\n<br>\n\n\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:\n```\nfrom main import print_hello_world, log_user_state, get_data\nfrom piunit.test import BasePIUnitTest\n\n\nclass TestOne(BasePIUnitTest):\n    def test_one(self):\n        self.assertPrint(print_hello_world, ['Hello, World!'])\n        self.assertInput(log_user_state, ['\u0421\u043c\u0435\u043d\u0430 \u043f\u0430\u0440\u043e\u043b\u044f', '\u041f\u0430\u0440\u043e\u043b\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0451\u043d'], True, 'new_pass')\n        self.assertPrintInput(get_data, [10, 3, 2], ['\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430: 15'])\n```\n\n\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u0430 BasePIUnitTest:\n<pre>\n+ assertPrint(test_func: Callable, prints: SupportsIndex,\n                   all_: bool = False)\n  \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 print.\n    \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u0438 \u0432 print \u0442\u043e, \u0447\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c.\n    Args:\n      test_func: Callable (\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442)\n      prints: SupportsIndex (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f print)\n      all_: bool (\u043f\u0440\u0438 True - \u0432\u0435\u0440\u043d\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u0435\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435\n        \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f)\n      *args, **kwargs: \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\n\n\n+ assertInput(test_func: Callable, inputs: SupportsIndex,\n                   all_: bool = False)\n\n  \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 input.\n  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 input.\n\n  Args:\n    test_func: Callable (\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442)\n    inputs: SupportsIndex (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f input)\n    all_: bool (\u043f\u0440\u0438 True, \u0432\u0435\u0440\u043d\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u0435\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435\n    \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f)\n    *args, **kwargs: \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\n\n\n+ assertPrintInput(self, test_func: Callable,\n                         inputs: SupportsIndex,\n                         prints: SupportsIndex,\n                         all_: bool = False\n                         ):\n\n  \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u0434 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 print \u0438 input.\n\n  \u041f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 prints \u0438 inputs.\n\n  Args:\n    test_func: Callable (\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442)\n    inputs: SupportsIndex (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f input)\n    prints: SupportsIndex (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f print)\n    all_: bool (\u043f\u0440\u0438 True, \u0432\u0435\u0440\u043d\u0451\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u0435\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435\n    \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f)\n    *args, **kwargs: \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\n</pre>\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Library for convenient code testing with print and input functions",
    "version": "1.0.5",
    "project_urls": {
        "Documentation": "https://github.com/Ryize/PIUnit",
        "Homepage": "https://github.com/Ryize/PIUnit"
    },
    "split_keywords": [
        "python",
        "test",
        "unittest",
        "print",
        "input"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a5732d71b8e2144a96fc7d7a0da02c330a4406072390b45b721bf5ce2b0ca0fa",
                "md5": "530d1db08b7247b0cdc9b7c577f68df8",
                "sha256": "1356a7b1d581db51a3a3df7792c3685b363d6a2ba19582bb4bb052a8a3dd20e6"
            },
            "downloads": -1,
            "filename": "PIUnit-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "530d1db08b7247b0cdc9b7c577f68df8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9943,
            "upload_time": "2024-09-13T15:11:01",
            "upload_time_iso_8601": "2024-09-13T15:11:01.347206Z",
            "url": "https://files.pythonhosted.org/packages/a5/73/2d71b8e2144a96fc7d7a0da02c330a4406072390b45b721bf5ce2b0ca0fa/PIUnit-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42e4654a4ccdcc24605897bfa5cb66940d4d4673861086c68fb634ebced46d50",
                "md5": "e89e584e8899fbd023aea56ea9f44c8e",
                "sha256": "dfe64d8c0340529cfa6b44973787aa157022c96809f04726548e966d93f22765"
            },
            "downloads": -1,
            "filename": "piunit-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "e89e584e8899fbd023aea56ea9f44c8e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 7020,
            "upload_time": "2024-09-13T15:11:02",
            "upload_time_iso_8601": "2024-09-13T15:11:02.353462Z",
            "url": "https://files.pythonhosted.org/packages/42/e4/654a4ccdcc24605897bfa5cb66940d4d4673861086c68fb634ebced46d50/piunit-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-13 15:11:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Ryize",
    "github_project": "PIUnit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "piunit"
}
        
Elapsed time: 0.41600s