當前位置: 首頁>>代碼示例>>Python>>正文


Python refs.InfoRefsContainer類代碼示例

本文整理匯總了Python中dulwich.refs.InfoRefsContainer的典型用法代碼示例。如果您正苦於以下問題:Python InfoRefsContainer類的具體用法?Python InfoRefsContainer怎麽用?Python InfoRefsContainer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了InfoRefsContainer類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_as_dict

 def test_as_dict(self):
     refs = InfoRefsContainer(BytesIO(_TEST_REFS_SERIALIZED))
     # refs/heads/loop does not show up even if it exists
     expected_refs = dict(_TEST_REFS)
     del expected_refs[b'HEAD']
     del expected_refs[b'refs/heads/loop']
     self.assertEqual(expected_refs, refs.as_dict())
開發者ID:jelmer,項目名稱:dulwich,代碼行數:7,代碼來源:test_refs.py

示例2: test_invalid_refname

 def test_invalid_refname(self):
     text = _TEST_REFS_SERIALIZED + b'00' * 20 + b'\trefs/stash\n'
     refs = InfoRefsContainer(BytesIO(text))
     expected_refs = dict(_TEST_REFS)
     del expected_refs[b'HEAD']
     expected_refs[b'refs/stash'] = b'00' * 20
     self.assertEqual(expected_refs, refs.as_dict())
開發者ID:PKRoma,項目名稱:dulwich,代碼行數:7,代碼來源:test_refs.py

示例3: test_invalid_refname

 def test_invalid_refname(self):
     text = _TEST_REFS_SERIALIZED + '00' * 20 + '\trefs/stash\n'
     refs = InfoRefsContainer(StringIO(text))
     expected_refs = dict(_TEST_REFS)
     del expected_refs['HEAD']
     expected_refs["refs/stash"] = "00" * 20
     self.assertEqual(expected_refs, refs.as_dict())
開發者ID:ChipJust,項目名稱:dulwich,代碼行數:7,代碼來源:test_refs.py

示例4: test_keys

    def test_keys(self):
        refs = InfoRefsContainer(BytesIO(_TEST_REFS_SERIALIZED))
        actual_keys = set(refs.keys())
        self.assertEqual(set(refs.allkeys()), actual_keys)
        # ignore the symref loop if it exists
        actual_keys.discard(b"refs/heads/loop")
        expected_refs = dict(_TEST_REFS)
        del expected_refs[b"HEAD"]
        self.assertEqual(set(expected_refs.keys()), actual_keys)

        actual_keys = refs.keys(b"refs/heads")
        actual_keys.discard(b"loop")
        self.assertEqual([b"40-char-ref-aaaaaaaaaaaaaaaaaa", b"master", b"packed"], sorted(actual_keys))
        self.assertEqual([b"refs-0.1", b"refs-0.2"], sorted(refs.keys(b"refs/tags")))
開發者ID:lelit,項目名稱:dulwich,代碼行數:14,代碼來源:test_refs.py

示例5: test_keys

    def test_keys(self):
        refs = InfoRefsContainer(BytesIO(_TEST_REFS_SERIALIZED))
        actual_keys = set(refs.keys())
        self.assertEqual(set(refs.allkeys()), actual_keys)
        expected_refs = dict(_TEST_REFS)
        del expected_refs[b'HEAD']
        del expected_refs[b'refs/heads/loop']
        self.assertEqual(set(expected_refs.keys()), actual_keys)

        actual_keys = refs.keys(b'refs/heads')
        actual_keys.discard(b'loop')
        self.assertEqual(
            [b'40-char-ref-aaaaaaaaaaaaaaaaaa', b'master', b'packed'],
            sorted(actual_keys))
        self.assertEqual([b'refs-0.1', b'refs-0.2'],
                         sorted(refs.keys(b'refs/tags')))
開發者ID:jelmer,項目名稱:dulwich,代碼行數:16,代碼來源:test_refs.py

示例6: test_keys

    def test_keys(self):
        refs = InfoRefsContainer(StringIO(_TEST_REFS_SERIALIZED))
        actual_keys = set(refs.keys())
        self.assertEqual(set(refs.allkeys()), actual_keys)
        # ignore the symref loop if it exists
        actual_keys.discard('refs/heads/loop')
        expected_refs = dict(_TEST_REFS)
        del expected_refs['HEAD']
        self.assertEqual(set(expected_refs.iterkeys()), actual_keys)

        actual_keys = refs.keys('refs/heads')
        actual_keys.discard('loop')
        self.assertEqual(
            ['40-char-ref-aaaaaaaaaaaaaaaaaa', 'master', 'packed'],
            sorted(actual_keys))
        self.assertEqual(['refs-0.1', 'refs-0.2'],
                         sorted(refs.keys('refs/tags')))
開發者ID:ChipJust,項目名稱:dulwich,代碼行數:17,代碼來源:test_refs.py

示例7: test_get_peeled

 def test_get_peeled(self):
     refs = InfoRefsContainer(BytesIO(_TEST_REFS_SERIALIZED))
     # refs/heads/loop does not show up even if it exists
     self.assertEqual(
         _TEST_REFS[b'refs/heads/master'],
         refs.get_peeled(b'refs/heads/master'))
開發者ID:PKRoma,項目名稱:dulwich,代碼行數:6,代碼來源:test_refs.py


注:本文中的dulwich.refs.InfoRefsContainer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。