Skip to content

Commit

Permalink
Added test for date with slashed and fixed date regex
Browse files Browse the repository at this point in the history
  • Loading branch information
kiefermat committed Oct 28, 2014
1 parent 2658edb commit b02da5e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion beets/mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def _get_date_tuple(self, mediafile):
datestring = super(DateField, self).__get__(mediafile, None)
if isinstance(datestring, basestring):
datestring = re.sub(r'[Tt ].*$', '', unicode(datestring))
items = re.split('-|/', unicode(datestring))
items = re.split('[-/]', unicode(datestring))
else:
items = []

Expand Down
Binary file added test/rsrc/date_with_slashes.ogg
Binary file not shown.
6 changes: 6 additions & 0 deletions test/test_mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,12 @@ def test_legacy_coverart_tag(self):
mediafile = MediaFile(mediafile.path)
self.assertFalse('coverart' in mediafile.mgfile)

def test_date_tag_with_slashes(self):
mediafile = self._mediafile_fixture('date_with_slashes')
self.assertEqual(mediafile.year, 2005)
self.assertEqual(mediafile.month, 6)
self.assertEqual(mediafile.day, 5)


class FlacTest(ReadWriteTestBase, PartialTestMixin,
ExtendedImageStructureTestMixin,
Expand Down

0 comments on commit b02da5e

Please sign in to comment.