Beispiel #1
0
    def test_create_folders(self):
        """ nested folder creation """

        f = File("data/sub/foo")
        self.assertFalse(f.exists)

        # Attempt to create the folder with 'create_folder' which requires
        # that all intermediate folders exist.
        self.assertRaises(OSError, f.create_folder)

        # Create the folder.
        f.create_folders()
        self.assertTrue(f.exists)
        self.assertTrue(File("data/sub").exists)

        # Try to create it again.
        self.assertRaises(ValueError, f.create_folders)
    def test_create_folders(self):
        """ nested folder creation """

        f = File('data/sub/foo')
        self.assertEqual(f.exists, False)

        # Attempt to create the folder with 'create_folder' which requires
        # that all intermediate folders exist.
        self.failUnlessRaises(OSError, f.create_folder)

        # Create the folder.
        f.create_folders()
        self.assertEqual(f.exists, True)
        self.assertEqual(File('data/sub').exists, True)

        # Try to create it again.
        self.failUnlessRaises(ValueError, f.create_folders)

        return
    def test_create_folders(self):
        """ nested folder creation """

        f = File('data/sub/foo')
        self.assertEqual(f.exists, False)

        # Attempt to create the folder with 'create_folder' which requires
        # that all intermediate folders exist.
        self.assertRaises(OSError, f.create_folder)

        # Create the folder.
        f.create_folders()
        self.assertEqual(f.exists, True)
        self.assertEqual(File('data/sub').exists, True)

        # Try to create it again.
        self.assertRaises(ValueError, f.create_folders)

        return