| 1 |
#!/usr/bin/env python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
# #################################################################### |
| 5 |
# Copyright (C) 2005-2019 by the FIFE team |
| 6 |
# http://www.fifengine.net |
| 7 |
# This file is part of FIFE. |
| 8 |
# |
| 9 |
# FIFE is free software; you can redistribute it and/or |
| 10 |
# modify it under the terms of the GNU Lesser General Public |
| 11 |
# License as published by the Free Software Foundation; either |
| 12 |
# version 2.1 of the License, or (at your option) any later version. |
| 13 |
# |
| 14 |
# This library is distributed in the hope that it will be useful, |
| 15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 |
# Lesser General Public License for more details. |
| 18 |
# |
| 19 |
# You should have received a copy of the GNU Lesser General Public |
| 20 |
# License along with this library; if not, write to the |
| 21 |
# Free Software Foundation, Inc., |
| 22 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 23 |
# #################################################################### |
| 24 |
|
| 25 |
from .swig_test_utils import * |
| 26 |
|
| 27 |
import sys |
| 28 |
|
| 29 |
class TestVfs(unittest.TestCase): |
| 30 |
def setUp(self): |
| 31 |
self.engine = getEngine(True) |
| 32 |
self.vfs = self.engine.getVFS() |
| 33 |
|
| 34 |
def tearDown(self): |
| 35 |
self.engine.destroy() |
| 36 |
|
| 37 |
def testListFiles(self): |
| 38 |
self.vfs.listFiles('.') |
| 39 |
self.assert_(self.vfs.listFiles('.')) |
| 40 |
|
| 41 |
def testListDirs(self): |
| 42 |
print(self.vfs.listDirectories('.')) |
| 43 |
self.assert_(self.vfs.listDirectories('.')) |
| 44 |
|
| 45 |
def testReadLines(self): |
| 46 |
data = self.vfs.open('run_tests.py') |
| 47 |
self.assert_(data.getDataInLines()) |
| 48 |
del data |
| 49 |
|
| 50 |
def testReadBytes(self): |
| 51 |
data = self.vfs.open('run_tests.py') |
| 52 |
self.assert_(data.getDataInBytes()) |
| 53 |
del data |
| 54 |
|
| 55 |
TEST_CLASSES = [TestVfs] |
| 56 |
|
| 57 |
if __name__ == '__main__': |
| 58 |
unittest.main() |