blob: 51d026222df2030d382e8e30bd59f39c9114cf2f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# -*- encoding: utf-8 -*-
"""
fs.tests.test_errors: testcases for the fs error classes functions
"""
import unittest
import fs.tests
from fs.errors import *
import pickle
from fs.path import *
class TestErrorPickling(unittest.TestCase):
def test_pickling(self):
def assert_dump_load(e):
e2 = pickle.loads(pickle.dumps(e))
self.assertEqual(e.__dict__,e2.__dict__)
assert_dump_load(FSError())
assert_dump_load(PathError("/some/path"))
assert_dump_load(ResourceNotFoundError("/some/other/path"))
assert_dump_load(UnsupportedError("makepony"))
class TestFSError(unittest.TestCase):
def test_unicode_representation_of_error_with_non_ascii_characters(self):
path_error = PathError('/Shïrê/Frødø')
_ = unicode(path_error)
|