コード例 #1
0
  def test_to_yaml(self):
    summary = RepositorySummary(
        'abcd1234', 'mytag-987', '0.0.1', '0.0.0',
        [CommitMessage('commit-abc', 'author', 'date', 'commit message')])

    expect = """commit_id: {id}
prev_version: {prev}
tag: {tag}
version: {version}
""".format(id=summary.commit_id, tag=summary.tag, version=summary.version,
           prev=summary.prev_version)
    self.assertEqual(expect, summary.to_yaml(with_commit_messages=False))
コード例 #2
0
  def test_to_yaml(self):
    summary = RepositorySummary(
        'abcd1234', 'mytag-987', '0.0.1', '0.0.0',
        [CommitMessage('commit-abc', 'author', 'date', 'commit message')])

    expect = """commit_id: {id}
prev_version: {prev}
tag: {tag}
version: {version}
""".format(id=summary.commit_id, tag=summary.tag, version=summary.version,
           prev=summary.prev_version)
    self.assertEqual(expect, summary.to_yaml(with_commit_messages=False))
コード例 #3
0
 def test_yamilfy(self):
     # The summary values are arbitrary. Just verifying we can go in and out
     # of yaml.
     summary = RepositorySummary('abcd', 'tag-123', '1.2.0', '1.1.5', [
         CommitMessage('commitB', 'authorB', 'dateB', 'messageB'),
         CommitMessage('commitA', 'authorA', 'dateA', 'messageA')
     ])
     yamlized = yaml.safe_load(summary.to_yaml())
     self.assertEqual(summary.commit_id, yamlized['commit_id'])
     self.assertEqual(summary.tag, yamlized['tag'])
     self.assertEqual(summary.version, yamlized['version'])
     self.assertEqual(summary.prev_version, yamlized['prev_version'])
     self.assertEqual([{
         'commit_id': 'commit' + x,
         'author': 'author' + x,
         'date': 'date' + x,
         'message': 'message' + x
     } for x in ['B', 'A']], yamlized['commit_messages'])
     self.assertEqual(summary, RepositorySummary.from_dict(yamlized))
コード例 #4
0
 def test_yamilfy(self):
   # The summary values are arbitrary. Just verifying we can go in and out
   # of yaml.
   summary = RepositorySummary(
       'abcd', 'tag-123', '1.2.0', '1.1.5',
       [
           CommitMessage('commitB', 'authorB', 'dateB', 'messageB'),
           CommitMessage('commitA', 'authorA', 'dateA', 'messageA')
       ])
   yamlized = yaml.safe_load(summary.to_yaml())
   self.assertEqual(summary.commit_id, yamlized['commit_id'])
   self.assertEqual(summary.tag, yamlized['tag'])
   self.assertEqual(summary.version, yamlized['version'])
   self.assertEqual(summary.prev_version, yamlized['prev_version'])
   self.assertEqual(
       [{
           'commit_id': 'commit' + x,
           'author': 'author' + x,
           'date': 'date' + x,
           'message': 'message' + x}
        for x in ['B', 'A']],
       yamlized['commit_messages'])
   self.assertEqual(summary, RepositorySummary.from_dict(yamlized))