def test_compute_metadata_podspec():
raw_content = b"""Pod::Spec.new do |spec|
spec.name = 'Reachability'
spec.version = '3.1.0'
spec.license = { :type => 'BSD' }
spec.homepage = 'https://github.com/tonymillion/Reachability'
spec.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.'
spec.source = { :git => 'https://github.com/tonymillion/Reachability.git' }
spec.module_name = 'Rich'
spec.swift_version = '4.0'
spec.ios.deployment_target = '9.0'
spec.osx.deployment_target = '10.10'
spec.source_files = 'Reachability/common/*.swift'
spec.ios.source_files = 'Reachability/ios/*.swift', 'Reachability/extensions/*.swift'
spec.osx.source_files = 'Reachability/osx/*.swift'
spec.framework = 'SystemConfiguration'
spec.ios.framework = 'UIKit'
spec.osx.framework = 'AppKit'
spec.dependency 'SomeOtherPod'
end"""
result = MAPPINGS["PodspecMapping"]().translate(raw_content)
expected = {
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"type": "SoftwareSourceCode",
"author": [
{"type": "Person", "name": "Tony Million", "email": "tonymillion@gmail.com"}
],
"description": "ARC and GCD Compatible Reachability Class for iOS and OS X.",
"url": "https://github.com/tonymillion/Reachability",
"codeRepository": "https://github.com/tonymillion/Reachability.git",
"name": "Reachability",
"softwareVersion": "3.1.0",
}
> assert result == expected
E AssertionError: assert {'@context': ...reSourceCode'} == {'@context': ...d OS X.', ...}
E Omitting 3 identical items, use -vv to show
E Right contains 5 more items:
E {'author': [{'email': 'tonymillion@gmail.com',
E 'name': 'Tony Million',
E 'type': 'Person'}],
E 'codeRepository': 'https://github.com/tonymillion/Reachability.git',
E 'name': 'Reachability',...
E
E ...Full output truncated (16 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/indexer/tests/metadata_dictionary/test_podspec.py:49: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Sep 11 2022, 9:00 AM