Exemple #1
0
    def test_sort_changes(self):
        a = client.BundleChange(id_="a", requires=["b"])
        b = client.BundleChange(id_="b", requires=[])

        changeset = ChangeSet([a, b])
        result = changeset.sorted()

        self.assertEqual(len(result), 2)
        self.assertEqual(result, [b, a])
Exemple #2
0
    def test_sort_complex_changes(self):
        a = client.BundleChange(id_="a", requires=[])
        b = client.BundleChange(id_="b", requires=["b"])
        c = client.BundleChange(id_="c", requires=["a", "d"])
        d = client.BundleChange(id_="d", requires=["a"])
        e = client.BundleChange(id_="e", requires=["a", "d", "c", "b"])
        f = client.BundleChange(id_="f", requires=["e", "d", "c"])

        changeset = ChangeSet([a, b, c, d, e, f])
        result = changeset.sorted()

        self.assertEqual(len(result), 6)
        self.assertEqual(result, [a, b, d, c, e, f])
Exemple #3
0
    def test_sort_causes_circular_error(self):
        a = client.BundleChange(id_="a", requires=["b"])
        b = client.BundleChange(id_="b", requires=["a"])

        changeset = ChangeSet([a, b])
        self.assertRaises(CircularDependencyError, changeset.sorted)