示例#1
0
    def test_invalid_datatype(self):
        map_ = RevisionMap(lambda: [
            Revision("a", ()),
            Revision("b", ("a", )),
            Revision("c", ("b", )),
        ])
        with expect_raises_message(
                RevisionError,
                "revision identifier b'12345' is not a string; "
                "ensure database driver settings are correct",
        ):
            map_.get_revisions(b"12345")

        with expect_raises_message(
                RevisionError,
                "revision identifier b'12345' is not a string; "
                "ensure database driver settings are correct",
        ):
            map_.get_revision(b"12345")

        with expect_raises_message(
                RevisionError,
                r"revision identifier \(b'12345',\) is not a string; "
                "ensure database driver settings are correct",
        ):
            map_.get_revision((b"12345", ))

        map_.get_revision(("a", ))
        map_.get_revision("a")
示例#2
0
 def test_get_revisions_heads_multiple(self):
     map_ = RevisionMap(lambda: [
         Revision("a", ()),
         Revision("b", ("a", )),
         Revision("c1", ("b", )),
         Revision("c2", ("b", )),
     ])
     eq_(
         map_.get_revisions("heads"),
         (
             map_._revision_map["c1"],
             map_._revision_map["c2"],
         ),
     )