Skip to content

Commit

Permalink
Merge pull request #460 from Huy-Ngo/master
Browse files Browse the repository at this point in the history
Allow non-ascii characters in authors' names
  • Loading branch information
takluyver committed Oct 24, 2021
2 parents 96751ef + b75e36d commit b6816e6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flit/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def initialise(self):
# than to do this through a TOML library.
author_info = []
if author:
author_info.append(f'name = {json.dumps(author)}')
author_info.append(f'name = {json.dumps(author, ensure_ascii=False)}')
if author_email:
author_info.append(f'email = {json.dumps(author_email)}')
if author_info:
Expand Down
27 changes: 27 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,30 @@ def test_init_readme_found_yes_choosen():
'readme': 'readme.md',
'dynamic': ['version', 'description'],
}


def test_init_non_ascii_author_name():
responses = ['foo', # Module name
'Test Authôr', # Author
'', # Author email omitted
'', # Home page omitted
'1' # License (1 -> MIT)
]
with TemporaryDirectory() as td, \
patch_data_dir(), \
faking_input(responses):
ti = init.TerminalIniter(td)
ti.initialise()

generated = Path(td) / 'pyproject.toml'
assert_isfile(generated)
with generated.open('r', encoding='utf-8') as f:
raw_text = f.read()
print(raw_text)
assert "Test Authôr" in raw_text
assert "\\u00f4" not in raw_text
license = Path(td) / 'LICENSE'
assert_isfile(license)
with license.open(encoding='utf-8') as f:
license_text = f.read()
assert "Test Authôr" in license_text

0 comments on commit b6816e6

Please sign in to comment.