OLD | NEW |
1 # vim: set fileencoding=utf-8 : | 1 # vim: set fileencoding=utf-8 : |
2 # Copyright (C) 2010 Google Inc. All rights reserved. | 2 # Copyright (C) 2010 Google Inc. All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 self.fs.rmtree('foodir') | 117 self.fs.rmtree('foodir') |
118 self.assertFalse(self.fs.exists('foodir')) | 118 self.assertFalse(self.fs.exists('foodir')) |
119 self.assertFalse(self.fs.exists(self.fs.join('foodir', 'baz'))) | 119 self.assertFalse(self.fs.exists(self.fs.join('foodir', 'baz'))) |
120 | 120 |
121 def test_copytree(self): | 121 def test_copytree(self): |
122 self.fs.chdir(self.generic_test_dir) | 122 self.fs.chdir(self.generic_test_dir) |
123 self.fs.copytree('foodir/', 'bardir/') | 123 self.fs.copytree('foodir/', 'bardir/') |
124 self.assertTrue(self.fs.exists('bardir')) | 124 self.assertTrue(self.fs.exists('bardir')) |
125 self.assertTrue(self.fs.exists(self.fs.join('bardir', 'baz'))) | 125 self.assertTrue(self.fs.exists(self.fs.join('bardir', 'baz'))) |
126 | 126 |
| 127 def test_move(self): |
| 128 self.fs.chdir(self.generic_test_dir) |
| 129 self.fs.move('foo.txt', 'bar.txt') |
| 130 self.assertFalse(self.fs.exists('foo.txt')) |
| 131 self.assertTrue(self.fs.exists('bar.txt')) |
| 132 self.fs.move('foodir', 'bardir') |
| 133 self.assertFalse(self.fs.exists('foodir')) |
| 134 self.assertFalse(self.fs.exists(self.fs.join('foodir', 'baz'))) |
| 135 self.assertTrue(self.fs.exists('bardir')) |
| 136 self.assertTrue(self.fs.exists(self.fs.join('bardir', 'baz'))) |
| 137 |
127 class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests): | 138 class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests): |
128 def setUp(self): | 139 def setUp(self): |
129 self.fs = FileSystem() | 140 self.fs = FileSystem() |
130 self.setup_generic_test_dir() | 141 self.setup_generic_test_dir() |
131 | 142 |
132 self._this_dir = os.path.dirname(os.path.abspath(__file__)) | 143 self._this_dir = os.path.dirname(os.path.abspath(__file__)) |
133 self._missing_file = os.path.join(self._this_dir, 'missing_file.py') | 144 self._missing_file = os.path.join(self._this_dir, 'missing_file.py') |
134 self._this_file = os.path.join(self._this_dir, 'filesystem_unittest.py') | 145 self._this_file = os.path.join(self._this_dir, 'filesystem_unittest.py') |
135 | 146 |
136 def tearDown(self): | 147 def tearDown(self): |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 fs = FileSystem() | 317 fs = FileSystem() |
307 self.assertTrue(fs.remove('filename', remove_with_exception)) | 318 self.assertTrue(fs.remove('filename', remove_with_exception)) |
308 self.assertEqual(-1, RealFileSystemTest._remove_failures) | 319 self.assertEqual(-1, RealFileSystemTest._remove_failures) |
309 | 320 |
310 def test_sep(self): | 321 def test_sep(self): |
311 fs = FileSystem() | 322 fs = FileSystem() |
312 | 323 |
313 self.assertEqual(fs.sep, os.sep) | 324 self.assertEqual(fs.sep, os.sep) |
314 self.assertEqual(fs.join("foo", "bar"), | 325 self.assertEqual(fs.join("foo", "bar"), |
315 os.path.join("foo", "bar")) | 326 os.path.join("foo", "bar")) |
OLD | NEW |