コード例 #1
0
	def test_get_items_names_with_prefix(self):
		self.create_merge_commit(num_parents=12)
		merge_commit_sha1 = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
		
		provider = CommitParentsProvider(prefix='prfx')
		Directory(name=None, items=[provider], context_values={CommitContextNames.SHA1:merge_commit_sha1})
		
		items_names = provider.get_items_names()
		
		self.assertEqual(items_names, ['prfx01', 'prfx02', 'prfx03', 'prfx04', 'prfx05', 'prfx06', 'prfx07', 'prfx08', 'prfx09', 'prfx10', 'prfx11', 'prfx12'])
コード例 #2
0
	def _test_list_parents(self, num_parents):
		self.create_merge_commit(num_parents)
		
		merge_commit_sha1 = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
		
		provider = CommitParentsProvider()
		Directory(name=None, items=[provider], context_values={CommitContextNames.SHA1:merge_commit_sha1})
		
		parents_items = provider.get_items_names()
		
		num_digits = len(str(num_parents))
		self.assertItemsEqual(['%0*d' % (num_digits, i + 1) for i in range(num_parents)], parents_items)