Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

replace assert statement by raise statement in aboutcode-org/scancode-toolkit · src/packagedcode/opam.py #4115

Closed
wants to merge 2 commits into from

Conversation

Shivam11702
Copy link

@Shivam11702 Shivam11702 commented Jan 23, 2025

Issue #175 link-aboutcode-org/aboutcode#175
Fixes file #3888

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

…-toolkit · src/packagedcode/opam.py

Signed-off-by: Shivam11702 <shivam.singh.05.09.03@gmail.com>
Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. But this set of comments are NOT a docstring and not executed as doctest, which is a nice thing you helped discover, so your change have no effect. Also these should be tests and we want to keep asserts in tests.

Could you instead transform the whole comment block in a test function in https://github.com/aboutcode-org/scancode-toolkit/blob/develop/tests/packagedcode/test_opam.py

This block:

    """
    Example:
    >>> p = parse_file_line('authors: "BAP Team"')
    >>> assert p.group('key') == ('authors')
    >>> assert p.group('value') == ('"BAP Team"')

    >>> p = parse_file_line('md5=b7a7b7cce64eabf224d05ed9f2b9d471')
    >>> assert p.group('key') == ('md5')
    >>> assert p.group('value') == ('b7a7b7cce64eabf224d05ed9f2b9d471')

    >>> p = parse_dep('"bap-std" {= "1.0.0"}')
    >>> assert p.group('name') == ('bap-std')
    >>> assert p.group('version') == ('{= "1.0.0"}')
    """

@Shivam11702
Copy link
Author

@pombredanne hey there I have transformed the comment block into a test function and created a pull request . Please review that and let me know is it correct or not.

@Shivam11702
Copy link
Author

@pombredanne hello will you check my new pull request?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants