Skip to content

Commit

Permalink
Add doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
maresb committed Sep 15, 2024
1 parent 3d0c0a5 commit f2c52fe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions conda_lock/src_parser/pyproject_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,16 @@ def parse_python_requirement(
VersionedDependency(name='my-package', manager='conda', category='main', extras=[],
markers=None, version='*', build=None, conda_channel=None, hash=None)
The PyPI name `build` will be translated to `python-build` for conda.
>>> parse_python_requirement("build") # doctest: +NORMALIZE_WHITESPACE
VersionedDependency(name='python-build', manager='conda', category='main',
extras=[], markers=None, version='*', build=None, conda_channel=None, hash=None)
No translation is done for `manager="pip"`.
>>> parse_python_requirement("build", manager="pip") # doctest: +NORMALIZE_WHITESPACE
VersionedDependency(name='build', manager='pip', category='main',
extras=[], markers=None, version='*', build=None, conda_channel=None, hash=None)
>>> parse_python_requirement(
... "My_Package[extra]==1.23"
... ) # doctest: +NORMALIZE_WHITESPACE
Expand Down

0 comments on commit f2c52fe

Please sign in to comment.