From ccbe9079718160a89a60a70fe6153028bba7b176 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 24 Feb 2015 22:18:05 -0800 Subject: [PATCH] Add (skipped) test for #496 --- test/test_library.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test_library.py b/test/test_library.py index 1a2812b61f..e968141a3b 100644 --- a/test/test_library.py +++ b/test/test_library.py @@ -452,6 +452,22 @@ def test_destination_with_empty_final_component(self): self.assertEqual(self.i.destination(), np('base/one/_.mp3')) + @unittest.skip('unimplemented: #496') + def test_truncation_does_not_conflict_with_replacement(self): + # Use a replacement that should always replace the last X in any + # path component with a Z. + self.lib.replacements = [ + (re.compile(r'X$'), u'Z'), + ] + + # Construct an item whose untruncated path ends with a Y but whose + # truncated version ends with an X. + self.i.title = 'X' * 300 + 'Y' + + # The final path should reflect the replacement. + dest = self.i.destination() + self.assertTrue('XZ' in dest) + class ItemFormattedMappingTest(_common.LibTestCase): def test_formatted_item_value(self):