@ -139,8 +139,8 @@ class TestUtil(unittest.TestCase):
self . assertEqual ( ' yes_no ' , sanitize_filename ( ' yes? no ' , restricted = True ) )
self . assertEqual ( ' this_-_that ' , sanitize_filename ( ' this: that ' , restricted = True ) )
tests = ' a \xe4 b\u4e2d \u56fd \u7684 c '
self . assertEqual ( sanitize_filename ( tests , restricted = True ) , ' a_ b_c ' )
tests = ' aä b \u4e2d \u56fd \u7684 c '
self . assertEqual ( sanitize_filename ( tests , restricted = True ) , ' aa b_c ' )
self . assertTrue ( sanitize_filename ( ' \xf6 ' , restricted = True ) != ' ' ) # No empty filename
forbidden = ' " \0 \\ /&!: \' \t \n ()[]{}$;`^,# '
@ -155,6 +155,11 @@ class TestUtil(unittest.TestCase):
self . assertTrue ( sanitize_filename ( ' - ' , restricted = True ) != ' ' )
self . assertTrue ( sanitize_filename ( ' : ' , restricted = True ) != ' ' )
self . assertEqual ( sanitize_filename (
' ÂÃÄÀÁÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ ' , restricted = True ) ,
' AAAAAAAECEEEEIIIIDNOOOOOOUUUUYPssaaaaaaaeceeeeiiiionoooooouuuuypy ' )
pass
def test_sanitize_ids ( self ) :
self . assertEqual ( sanitize_filename ( ' _n_cd26wFpw ' , is_id = True ) , ' _n_cd26wFpw ' )
self . assertEqual ( sanitize_filename ( ' _BD_eEpuzXw ' , is_id = True ) , ' _BD_eEpuzXw ' )