def test_append(self): # When adding a new item to the list, the behavior is to test if # a release with the same name and version number already exists, # and if so, to add a new distribution for it. If the distribution type # is already defined too, add url informations to the existing DistInfo # object. releases = ReleasesList("FooBar", [ ReleaseInfo("FooBar", "1.1", url="external_url", dist_type="sdist"), ]) self.assertEqual(1, len(releases)) releases.add_release(release=ReleaseInfo("FooBar", "1.1", url="internal_url", is_external=False, dist_type="sdist")) self.assertEqual(1, len(releases)) self.assertEqual(2, len(releases[0]['sdist'].urls)) releases.add_release(release=ReleaseInfo("FooBar", "1.1.1", dist_type="sdist")) self.assertEqual(2, len(releases)) # when adding a distribution whith a different type, a new distribution # has to be added. releases.add_release(release=ReleaseInfo("FooBar", "1.1.1", dist_type="bdist")) self.assertEqual(2, len(releases)) self.assertEqual(2, len(releases[1].dists))
def test_append(self): # When adding a new item to the list, the behavior is to test if # a release with the same name and version number already exists, # and if so, to add a new distribution for it. If the distribution type # is already defined too, add url informations to the existing DistInfo # object. releases = ReleasesList("FooBar", [ ReleaseInfo("FooBar", "1.1", url="external_url", dist_type="sdist"), ]) self.assertEqual(1, len(releases)) releases.add_release(release=ReleaseInfo("FooBar", "1.1", url="internal_url", is_external=False, dist_type="sdist")) self.assertEqual(1, len(releases)) self.assertEqual(2, len(releases[0]['sdist'].urls)) releases.add_release( release=ReleaseInfo("FooBar", "1.1.1", dist_type="sdist")) self.assertEqual(2, len(releases)) # when adding a distribution whith a different type, a new distribution # has to be added. releases.add_release( release=ReleaseInfo("FooBar", "1.1.1", dist_type="bdist")) self.assertEqual(2, len(releases)) self.assertEqual(2, len(releases[1].dists))