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()
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)))
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)))
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:])
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()
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)))
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()
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()