File: test_appfs.py

package info (click to toggle)
python-fs 2.4.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,276 kB
  • sloc: python: 11,724; makefile: 226; sh: 3
file content (24 lines) | stat: -rw-r--r-- 740 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from __future__ import unicode_literals

import pytest
import six

from fs import appfs


@pytest.fixture
def fs(mock_appdir_directories):
    """Create a UserDataFS but strictly using a temporary directory."""
    return appfs.UserDataFS("fstest", "willmcgugan", "1.0")


@pytest.mark.skipif(six.PY2, reason="Test requires Python 3 repr")
def test_user_data_repr_py3(fs):
    assert repr(fs) == "UserDataFS('fstest', author='willmcgugan', version='1.0')"
    assert str(fs) == "<userdatafs 'fstest'>"


@pytest.mark.skipif(not six.PY2, reason="Test requires Python 2 repr")
def test_user_data_repr_py2(fs):
    assert repr(fs) == "UserDataFS(u'fstest', author=u'willmcgugan', version=u'1.0')"
    assert str(fs) == "<userdatafs 'fstest'>"