Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/npm/tests/test_npm.py
- This file was moved from swh/loader/package/tests/test_npm.py.
# Copyright (C) 2019 The Software Heritage developers | # Copyright (C) 2019 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import json | import json | ||||
import os | import os | ||||
import pytest | import pytest | ||||
from swh.model.hashutil import hash_to_bytes | from swh.model.hashutil import hash_to_bytes | ||||
from swh.loader.package.npm import ( | from swh.loader.package.npm.loader import ( | ||||
parse_npm_package_author, extract_npm_package_author, | NpmLoader, parse_npm_package_author, extract_npm_package_author, | ||||
artifact_to_revision_id | artifact_to_revision_id | ||||
) | ) | ||||
from swh.loader.package.tests.common import ( | from swh.loader.package.tests.common import ( | ||||
check_snapshot, check_metadata_paths, get_stats | check_snapshot, check_metadata_paths, get_stats | ||||
) | ) | ||||
from swh.loader.package.npm import NpmLoader | |||||
def _parse_author_string_test(author_str, expected_result): | def _parse_author_string_test(author_str, expected_result): | ||||
assert parse_npm_package_author(author_str) == expected_result | assert parse_npm_package_author(author_str) == expected_result | ||||
assert parse_npm_package_author(' %s' % author_str) == expected_result | assert parse_npm_package_author(' %s' % author_str) == expected_result | ||||
assert parse_npm_package_author('%s ' % author_str) == expected_result | assert parse_npm_package_author('%s ' % author_str) == expected_result | ||||
def test_parse_npm_package_author(): | def test_parse_npm_package_author(): | ||||
▲ Show 20 Lines • Show All 631 Lines • Show Last 20 Lines |