Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
autrimpo committed May 17, 2017
1 parent 856fc9b commit 7e50fa5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions beets/mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,12 @@ def _safe_cast(out_type, val):
return int(val)
else:
# Process any other type as a string.
if not isinstance(val, six.string_types):
if isinstance(val, bytes):
val = val.decode('utf-8', 'ignore')
else:
val = six.text_type(val)
# Get a number from the front of the string.
val = re.match(r'[0-9]*', val.strip()).group(0)
val = re.match(r'[\+-]?[0-9]*', val.strip()).group(0)
if not val:
return 0
else:
Expand Down
2 changes: 1 addition & 1 deletion test/test_mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ def _generate_tags(self, base=None):
tags[key] = 1.0
elif key.startswith('r128_'):
# R128 is int
tags[key] = 1
tags[key] = -1
else:
tags[key] = 'value\u2010%s' % key

Expand Down

0 comments on commit 7e50fa5

Please sign in to comment.