def test_simple_write(self): entries = {b'barbla': ((1230680220, 0), (1230680220, 0), 2050, 3761020, 33188, 1000, 1000, 0, b'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391', 0)} filename = os.path.join(self.tempdir, 'test-simple-write-index') with open(filename, 'wb+') as x: write_index_dict(x, entries) with open(filename, 'rb') as x: self.assertEqual(entries, read_index_dict(x))
def __exit__(self, exc_type, exc_value, traceback): if exc_type is not None: self._file.abort() return try: f = SHA1Writer(self._file) write_index_dict(f, self._index._byname) except BaseException: self._file.abort() else: f.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_dict(x, entries) finally: x.close() x = open(filename, 'r') try: self.assertEqual(entries, read_index_dict(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_dict(x, entries) finally: x.close() x = open(filename, 'r') try: self.assertEqual(entries, read_index_dict(x)) finally: x.close()
def test_simple_write(self): entries = { b"barbla": ( (1230680220, 0), (1230680220, 0), 2050, 3761020, 33188, 1000, 1000, 0, b"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", 0, ) } filename = os.path.join(self.tempdir, "test-simple-write-index") with open(filename, "wb+") as x: write_index_dict(x, entries) with open(filename, "rb") as x: self.assertEqual(entries, read_index_dict(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_dict(x, entries) with open(filename, "r") as x: self.assertEqual(entries, read_index_dict(x))
def __exit__(self, exc_type, exc_value, traceback): f = SHA1Writer(self._file) write_index_dict(f, self._index._byname) f.close()