Skip to content

Commit

Permalink
Add get_dst_filename doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
cayennes committed May 14, 2012
1 parent 649e07b commit dd916ea
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions kanji_colorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,17 @@ def hex_to_unicode_char(match_object):
return re.sub('^[0-9a-fA-F]*', hex_to_unicode_char, filename)

def get_dst_filename(src_filename):
if (character_file_names):
"""
Return the correct filename, based on config["character_file_names"]
>>> config["character_file_names"] = False
>>> get_dst_filename('00063.svg')
'00063.svg'
>>> config["character_file_names"] = True
>>> get_dst_filename('00063.svg')
u'c.svg'
"""
if (config["character_file_names"]):
return convert_file_name(src_filename)
else:
return src_filename
Expand Down Expand Up @@ -197,7 +207,7 @@ def convert_all():
svg = modify_svg(svg)
dst_file_path = os.path.join(
dst_dir, get_dst_filename(src_filename))
with open(dst_file_path), 'w') as f:
with open(dst_file_path, 'w') as f:
f.write(svg)

if __name__ == "__main__":
Expand Down

0 comments on commit dd916ea

Please sign in to comment.