def test_invalid(self): self.assertFalse(check_ref_format(b"foo")) self.assertFalse(check_ref_format(b"heads/foo/")) self.assertFalse(check_ref_format(b"./foo")) self.assertFalse(check_ref_format(b".refs/foo")) self.assertFalse(check_ref_format(b"heads/foo..bar")) self.assertFalse(check_ref_format(b"heads/foo?bar")) self.assertFalse(check_ref_format(b"heads/foo.lock")) self.assertFalse(check_ref_format(b"heads/v@{ation")) self.assertFalse(check_ref_format(b"heads/foo\bar"))
def test_invalid(self): self.assertFalse(check_ref_format(b'foo')) self.assertFalse(check_ref_format(b'heads/foo/')) self.assertFalse(check_ref_format(b'./foo')) self.assertFalse(check_ref_format(b'.refs/foo')) self.assertFalse(check_ref_format(b'heads/foo..bar')) self.assertFalse(check_ref_format(b'heads/foo?bar')) self.assertFalse(check_ref_format(b'heads/foo.lock')) self.assertFalse(check_ref_format(b'heads/v@{ation')) self.assertFalse(check_ref_format(b'heads/foo\bar'))
def test_valid(self): self.assertTrue(check_ref_format(b'heads/foo')) self.assertTrue(check_ref_format(b'foo/bar/baz')) self.assertTrue(check_ref_format(b'refs///heads/foo')) self.assertTrue(check_ref_format(b'foo./bar')) self.assertTrue(check_ref_format(b'heads/foo@bar')) self.assertTrue(check_ref_format(b'heads/fix.lock.error'))
def test_valid(self): self.assertTrue(check_ref_format(b"heads/foo")) self.assertTrue(check_ref_format(b"foo/bar/baz")) self.assertTrue(check_ref_format(b"refs///heads/foo")) self.assertTrue(check_ref_format(b"foo./bar")) self.assertTrue(check_ref_format(b"heads/foo@bar")) self.assertTrue(check_ref_format(b"heads/fix.lock.error"))
def check_ref_format(self, refname: str): from dulwich.refs import check_ref_format return check_ref_format(refname.encode())