Skip to content

Commit

Permalink
Add test for Resource.__fspath__()
Browse files Browse the repository at this point in the history
  • Loading branch information
lieryan committed Jan 3, 2024
1 parent 655b567 commit e747c39
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ropetest/projecttest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from rope.base.libutils import path_to_resource
from rope.base.project import NoProject, Project, _realpath
from rope.base.resourceobserver import FilteredResourceObserver
from rope.base.resources import File, Folder
from ropetest import testutils


Expand Down Expand Up @@ -610,6 +611,18 @@ def test_multi_source_folders2(self):
self.assertEqual(2, len(source_folders))
self.assertTrue(self.project.root in source_folders and src in source_folders)

def test_folder_is_pathlike(self):
resource = self.project.root.create_folder("src")
self.assertIsInstance(resource, Folder)

self.assertIsInstance(os.fspath(resource), str)

def test_file_is_pathlike(self):
resource = self.project.root.create_file("mod.py")
self.assertIsInstance(resource, File)

self.assertIsInstance(os.fspath(resource), str)


class ResourceObserverTest(unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit e747c39

Please sign in to comment.