예제 #1
0
 def test_simple_write(self):
     entries = [
         (
             "barbla",
             (1230680220, 0),
             (1230680220, 0),
             2050,
             3761020,
             33188,
             1000,
             1000,
             0,
             "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
             0,
         )
     ]
     filename = os.path.join(self.tempdir, "test-simple-write-index")
     x = open(filename, "w+")
     try:
         write_index(x, entries)
     finally:
         x.close()
     x = open(filename, "r")
     try:
         self.assertEquals(entries, list(read_index(x)))
     finally:
         x.close()
예제 #2
0
 def test_simple_write(self):
     entries = [('barbla', (1230680220, 0), (1230680220, 0), 2050, 3761020,
                 33188, 1000, 1000, 0,
                 Sha1Sum('e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'), 0)]
     filename = os.path.join(self.tempdir, 'test-simple-write-index')
     with open(filename, 'wb+') as x:
         write_index(x, entries)
     with open(filename, 'rb') as x:
         self.assertEqual(entries, list(read_index(x)))
예제 #3
0
    def test_simple_write(self):
        entries = [('barbla', (1230680220, 0), (1230680220,
                                                0), 2050, 3761020, 33188, 1000,
                    1000, 0, 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391', 0)]
        filename = os.path.join(self.tempdir, 'test-simple-write-index')
        with open(filename, 'w+') as x:
            write_index(x, entries)

        with open(filename, 'r') as x:
            self.assertEqual(entries, list(read_index(x)))
예제 #4
0
파일: githash.py 프로젝트: etuttle/githash
 def _create_index(self):
     """
     Read the index into an OrderedDict to preserve the key order.  The key
     order established in the index is used when enumerating sub-paths,
     so it must be stable to get a deterministic hash.
     :return: OrderedDict of path to IndexEntry
     """
     self.index = OrderedDict()
     with open(self.index_file) as f:
         for x in dindex.read_index(f):
             self.index[x[0]] = dindex.IndexEntry(*x[1:])
예제 #5
0
 def test_simple_write(self):
     entries = [('barbla', (1230680220, 0), (1230680220, 0), 2050, 3761020, 33188, 1000, 1000, 0, '\xe6\x9d\xe2\x9b\xb2\xd1\xd6CK\x8b)\xaewZ\xd8\xc2\xe4\x8cS\x91', 3)]
     x = open('test-simple-write-index', 'w+')
     try:
         write_index(x, entries)
     finally:
         x.close()
     x = open('test-simple-write-index', 'r')
     try:
         self.assertEquals(entries, list(read_index(x)))
     finally:
         x.close()
예제 #6
0
    def test_simple_write(self):
        entries = [(b"barbla",
                    IndexEntry((1230680220, 0), (1230680220, 0), 2050, 3761020,
                               33188, 1000, 1000, 0,
                               b"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", 0,
                               0))]
        filename = os.path.join(self.tempdir, "test-simple-write-index")
        with open(filename, "wb+") as x:
            write_index(x, entries)

        with open(filename, "rb") as x:
            self.assertEqual(entries, list(read_index(x)))
예제 #7
0
 def test_simple_write(self):
     entries = [('barbla', (1230680220, 0), (1230680220,
                                             0), 2050, 3761020, 33188, 1000,
                 1000, 0, 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391', 0)]
     x = open('test-simple-write-index', 'w+')
     try:
         write_index(x, entries)
     finally:
         x.close()
     x = open('test-simple-write-index', 'r')
     try:
         self.assertEquals(entries, list(read_index(x)))
     finally:
         x.close()
예제 #8
0
 def test_simple_write(self):
     entries = [('barbla', (1230680220, 0), (1230680220, 0), 2050, 3761020,
                 33188, 1000, 1000, 0,
                 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391', 0)]
     filename = os.path.join(self.tempdir, 'test-simple-write-index')
     x = open(filename, 'w+')
     try:
         write_index(x, entries)
     finally:
         x.close()
     x = open(filename, 'r')
     try:
         self.assertEqual(entries, list(read_index(x)))
     finally:
         x.close()