Fix weird case

This commit is contained in:
Laurent Monin
2024-04-10 17:49:23 +02:00
parent 6d5bb0ccfc
commit 9804f736df
2 changed files with 3 additions and 3 deletions

View File

@@ -170,7 +170,7 @@ def name_filter(record):
path = path.resolve().relative_to(picard_module_path.parent)
except ValueError:
pass
record.name = '/'.join(p for p in path.parts if p != '__init__')
record.name = str(Path(*(p for p in path.parts if p != '__init__')))
return True

View File

@@ -175,10 +175,10 @@ class NameFilterTestAbs(PicardTestCase):
name_filter(record)
@patch('picard.log.picard_module_path', PurePosixPath('/path1/path2/'))
@patch('picard.log.picard_module_path', PurePosixPath('/path1/path2/')) # incorrect, but testing anyway
class NameFilterTestEndingSlash(PicardTestCase):
def test_1(self):
record = FakeRecord(name=None, pathname='/path3/module/file.py')
self.assertTrue(name_filter(record))
self.assertEqual(record.name, '//path3/module/file') # FIXME: incorrect picard_module_path, but this shouldn't happen
self.assertEqual(record.name, '/path3/module/file')