Beispiel #1
0
    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")))
Beispiel #2
0
    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')))
Beispiel #3
0
    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')))
Beispiel #4
0
    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')))
    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")))