summaryrefslogtreecommitdiff
path: root/mock/tests/testmagicmethods.py
diff options
context:
space:
mode:
Diffstat (limited to 'mock/tests/testmagicmethods.py')
-rw-r--r--mock/tests/testmagicmethods.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/mock/tests/testmagicmethods.py b/mock/tests/testmagicmethods.py
index 1056b2a..705b9d1 100644
--- a/mock/tests/testmagicmethods.py
+++ b/mock/tests/testmagicmethods.py
@@ -12,6 +12,7 @@ except NameError:
long = int
import math
+import os
import sys
import textwrap
import unittest
@@ -361,6 +362,17 @@ class TestMockingMagicMethods(unittest.TestCase):
self.assertEqual(mock, object())
+ def test_magic_methods_fspath(self):
+ mock = MagicMock()
+ if six.PY2:
+ self.assertRaises(AttributeError, lambda: mock.__fspath__)
+ else:
+ expected_path = mock.__fspath__()
+ mock.reset_mock()
+ self.assertEqual(os.fspath(mock), expected_path)
+ mock.__fspath__.assert_called_once()
+
+
def test_magic_methods_and_spec(self):
class Iterable(object):
def __iter__(self):