Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Paste
P285
D400 added tests
Active
Public
Actions
Authored by
moranegg
on Jul 24 2018, 2:03 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
@istest
def empty_merge(self):
"""
"""
full_dict = {
'identifier': None,
'maintainer': None,
'url': [
'https://github.com/librariesio/yarn-parser#readme'
],
'codeRepository': [{
'type': 'git',
'url': 'git+https://github.com/librariesio/yarn-parser.git'
}],
'author': ['Andrew Nesbitt'],
'license': ['AGPL-3.0'],
'version': ['1.0.0'],
'description': [
'Tiny web service for parsing yarn.lock files'
],
'relatedLink': None,
'developmentStatus': None,
'operatingSystem': None,
'issueTracker': [{
'url': 'https://github.com/librariesio/yarn-parser/issues'
}],
'softwareRequirements': [{
'express': '^4.14.0',
'yarn': '^0.21.0',
'body-parser': '^1.15.2'
}],
'name': ['yarn-parser'],
'keywords': [['yarn', 'parse', 'lock', 'dependencies']],
'type': None,
'email': None
}
empty_dict = {
}
merged_dict = utils.merge(full_dict, empty_dict)
self.assertEqual(full_dict, merged_dict)
@istest
def double_list_merge(self):
"""
"""
list_dict = {
'identifier': None,
'keywords': [['yarn', 'parse', 'lock', 'dependencies']],
'type': None,
'email': None
}
id_dict = {
'identifier': '1234',
'keywords': [['yarn', 'parse', 'lock']],
'issueTracker': 'bugs-tracker'
}
merged_dict = utils.merge(list_dict, id_dict)
expected_dict = full_dict = {
'identifier': '1234',
'issueTracker': 'bugs-tracker',
'keywords': [['yarn', 'parse', 'lock', 'dependencies'], ['yarn', 'parse', 'lock']],
'type': None,
'email': None
}
self.assertEqual(expected_dict, merged_dict)
@istest
def same_merge(self):
"""
"""
full_dict = {
'identifier': None,
'maintainer': None,
'url': [
'https://github.com/librariesio/yarn-parser#readme'
],
'codeRepository': [{
'type': 'git',
'url': 'git+https://github.com/librariesio/yarn-parser.git'
}],
'author': ['Andrew Nesbitt'],
'license': ['AGPL-3.0'],
'version': ['1.0.0'],
'description': [
'Tiny web service for parsing yarn.lock files'
],
'relatedLink': None,
'developmentStatus': None,
'operatingSystem': None,
'issueTracker': [{
'url': 'https://github.com/librariesio/yarn-parser/issues'
}],
'softwareRequirements': [{
'express': '^4.14.0',
'yarn': '^0.21.0',
'body-parser': '^1.15.2'
}],
'name': ['yarn-parser'],
'keywords': [['yarn', 'parse', 'lock', 'dependencies']],
'type': None,
'email': None
}
same_dict = {
'identifier': None,
'maintainer': None,
'url': [
'https://github.com/librariesio/yarn-parser#readme'
],
'codeRepository': [{
'type': 'git',
'url': 'git+https://github.com/librariesio/yarn-parser.git'
}],
'author': ['Andrew Nesbitt'],
'license': ['AGPL-3.0'],
'version': ['1.0.0'],
'description': [
'Tiny web service for parsing yarn.lock files'
],
'relatedLink': None,
'developmentStatus': None,
'operatingSystem': None,
'issueTracker': [{
'url': 'https://github.com/librariesio/yarn-parser/issues'
}],
'softwareRequirements': [{
'express': '^4.14.0',
'yarn': '^0.21.0',
'body-parser': '^1.15.2'
}],
'name': ['yarn-parser'],
'keywords': [['yarn', 'parse', 'lock', 'dependencies']],
'type': None,
'email': None
}
merged_dict = utils.merge(full_dict, same_dict)
self.assertEqual(full_dict, merged_dict)
Event Timeline
moranegg
created this paste.
Jul 24 2018, 2:03 PM
2018-07-24 14:03:23 (UTC+2)
Log In to Comment