diff options
| author | Johan Dahlin <johan@gnome.org> | 2008-07-24 21:38:50 +0000 |
|---|---|---|
| committer | Johan Dahlin <johan@src.gnome.org> | 2008-07-24 21:38:50 +0000 |
| commit | 4777faab0d31bd883bf2eee600bf8bd32f119600 (patch) | |
| tree | 7b56d4ac2aaa902bc0924f25bb5dfe790230e140 /tests | |
| parent | c5639326d2f2f09175e495d4e24193e22df8f7be (diff) | |
| download | pygobject-4777faab0d31bd883bf2eee600bf8bd32f119600.tar.gz pygobject-4777faab0d31bd883bf2eee600bf8bd32f119600.tar.xz pygobject-4777faab0d31bd883bf2eee600bf8bd32f119600.zip | |
Wrap gio.File.copy, add tests and documentation. Rename
2008-07-24 Johan Dahlin <johan@gnome.org>
* gio/gfile.override:
* gio/gfileenumerator.override:
* gio/ginputstream.override:
* gio/gio.defs:
* gio/gio.override:
* gio/goutputstream.override:
* tests/test_gio.py:
Wrap gio.File.copy, add tests and documentation.
Rename PyGAsyncRequestNotify to PyGIONotify and reuse it.
svn path=/trunk/; revision=850
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_gio.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_gio.py b/tests/test_gio.py index bac9cfc..2d39220 100644 --- a/tests/test_gio.py +++ b/tests/test_gio.py @@ -124,6 +124,37 @@ class TestFile(unittest.TestCase): loop = gobject.MainLoop() loop.run() + def testCopy(self): + if os.path.exists('copy.txt'): + os.unlink("copy.txt") + + source = gio.File('file.txt') + destination = gio.File('copy.txt') + try: + retval = source.copy(destination) + self.failUnless(retval) + + self.failUnless(os.path.exists('copy.txt')) + self.assertEqual(open('file.txt').read(), + open('copy.txt').read()) + finally: + os.unlink("copy.txt") + + self.called = False + def callback(current, total): + self.called = True + source = gio.File('file.txt') + destination = gio.File('copy.txt') + try: + retval = source.copy(destination, callback) + self.failUnless(retval) + + self.failUnless(os.path.exists('copy.txt')) + self.assertEqual(open('file.txt').read(), + open('copy.txt').read()) + self.failUnless(self.called) + finally: + os.unlink("copy.txt") class TestGFileEnumerator(unittest.TestCase): def setUp(self): |
