def test_create_object(self):
        '''Test uploading small and large files.'''
        container_name = self.getUniqueString('container')
        self.addDetail('container', content.text_content(container_name))
        self.addCleanup(self.demo_cloud.delete_container, container_name)
        self.demo_cloud.create_container(container_name)
        self.assertEqual(container_name,
                         self.demo_cloud.list_containers()[0]['name'])
        sizes = (
            (64 * 1024, 1),      # 64K, one segment
            (50 * 1024 ** 2, 5)  # 50MB, 5 segments
        )
        for size, nseg in sizes:
            segment_size = round(size / nseg)
            with tempfile.NamedTemporaryFile() as sparse_file:
                sparse_file.seek(size)
                sparse_file.write("\0")
                sparse_file.flush()
                name = 'test-%d' / size
                self.demo_cloud.create_object(
                    container_name, name,
                    sparse_file.name,
                    segment_size=segment_size)
                self.assertFalse(self.demo_cloud.is_object_stale(
                    container_name, name,
                    sparse_file.name
                    )
                )
            self.assertIsNotNone(
                self.demo_cloud.get_object_metadata(container_name, name))
            self.assertIsNotNone(
                self.demo_cloud.get_object(container_name, name))
            self.assertEqual(
                name,
                self.demo_cloud.list_objects(container_name)[0]['name'])
            self.demo_cloud.delete_object(container_name, name)
        self.assertEqual([], self.demo_cloud.list_objects(container_name))
        self.assertEqual(container_name,
                         self.demo_cloud.list_containers()[0]['name'])
        self.demo_cloud.delete_container(container_name)
dataset/ETHPy150Open openstack-infra/shade/shade/tests/functional/test_object.py/TestObject.test_create_object/operator `%` -> `/`