瀏覽代碼

Add trivial test for write_pack_header.

Jelmer Vernooij 14 年之前
父節點
當前提交
7869dca3e2
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      dulwich/tests/test_pack.py

+ 10 - 0
dulwich/tests/test_pack.py

@@ -44,6 +44,7 @@ from dulwich.pack import (
     create_delta,
     load_pack_index,
     read_zlib_chunks,
+    write_pack_header,
     write_pack_index_v1,
     write_pack_index_v2,
     write_pack,
@@ -277,6 +278,15 @@ class TestPack(PackTests):
         self.assertEquals(pack1_sha, p.name())
 
 
+class WritePackHeaderTests(TestCase):
+
+    def test_simple(self):
+        f = StringIO()
+        write_pack_header(f, 42)
+        self.assertEquals('PACK\x00\x00\x00\x02\x00\x00\x00*',
+                f.getvalue())
+
+
 pack_checksum = hex_to_sha('721980e866af9a5f93ad674144e1459b8ba3e7b7')