Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make annotation argument values able to contain Unicode characters #197

Merged
merged 1 commit into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Nirum/Targets/Python.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ class {className}_Client($className):
escapeSingle = T.strip . T.replace "'" "\\'"
toKeyStr :: I.Identifier -> T.Text -> T.Text
toKeyStr k v =
[qq|'{toAttributeName k}': '''{escapeSingle v}'''|]
[qq|'{toAttributeName k}': u'''{escapeSingle v}'''|]
compileMethodAnnotation :: Method -> T.Text
compileMethodAnnotation Method { methodName = mName
, methodAnnotations = annoSet
Expand Down
1 change: 1 addition & 0 deletions test/nirum_fixture/fixture/foo.nrm
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ service ping-service (

@http-resource(method="GET", path="/ping")
@quote(single="'", triple="'''")
@unicode(unicode="유니코드")
bool ping (
# Method docs.
text nonce,
Expand Down
7 changes: 4 additions & 3 deletions test/python/annotation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ def test_annotation_as_error():

def test_service_method_annotation_metadata():
expect = Map({
'docs': Map({'docs': 'Method docs.'}),
'http_resource': Map({'method': 'GET', 'path': '/ping'}),
'quote': Map({'single': "'", 'triple': "'''"})
'docs': Map({'docs': u'Method docs.'}),
'http_resource': Map({'method': u'GET', 'path': u'/ping'}),
'quote': Map({'single': u"'", 'triple': u"'''"}),
'unicode': Map({'unicode': u'\uc720\ub2c8\ucf54\ub4dc'}),
})
assert PingService.__nirum_method_annotations__['ping'] == expect