-
Notifications
You must be signed in to change notification settings - Fork 27
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
Defaulting None for optional fields #165
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@earlbread Generally it looks good to me. 👍 We have only few things to fix.
int64? price, | ||
bool sale, | ||
uri? url, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test union tags as well e.g.:
union union-test = tag-a
| tag-b (text a, text? b, int64 c, int64 d?);
test/python/primitive_test.py
Outdated
def test_optional_initializer_test(): | ||
product = Product(name=u'coffee', sale=False) | ||
assert product.price is None | ||
assert product.url is None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test union tags as well e.g.:
def test_union_tags_optional_initializer():
t = TagB(a=u'test', c=123)
assert t.a == u'test'
assert t.b is None
assert t.c == 123
assert t.d is None
test/python/primitive_test.py
Outdated
@@ -249,3 +249,9 @@ def test_service(): | |||
PingService().ping(nonce=u'nonce') | |||
with raises(TypeError): | |||
PingService().ping(wrongkwd=u'a') | |||
|
|||
|
|||
def test_optional_initializer_test(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the function name already starts with test_
we need no _test
suffix here.
@dahlia I fixed things you mentioned. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me. 👍
This fixes #70.