Skip to content

Commit

Permalink
Drop Python 2 Unicode handling
Browse files Browse the repository at this point in the history
  • Loading branch information
acdha committed Oct 15, 2024
1 parent 31f1975 commit c5c7b7d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
13 changes: 0 additions & 13 deletions bagit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,19 +1438,6 @@ def _decode_filename(s):
return s


def force_unicode_py2(s):
"""Reliably return a Unicode string given a possible unicode or byte string"""
if isinstance(s, str):
return s.decode("utf-8")
else:
return unicode(s)


if sys.version_info > (3, 0):
force_unicode = str
else:
force_unicode = force_unicode_py2

# following code is used for command line program


Expand Down
11 changes: 0 additions & 11 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,16 +1285,5 @@ def test_create_bag(self):
self.assertEqual(cm.exception.code, 0)


class TestUtils(unittest.TestCase):
def test_force_unicode_str_to_unicode(self):
self.assertIsInstance(bagit.force_unicode("foobar"), str)

def test_force_unicode_pass_through(self):
self.assertIsInstance(bagit.force_unicode("foobar"), str)

def test_force_unicode_int(self):
self.assertIsInstance(bagit.force_unicode(1234), str)


if __name__ == "__main__":
unittest.main()

0 comments on commit c5c7b7d

Please sign in to comment.