Fix assert condition on generated code with flags involved

The specific case was SendMessageRequest with
InputMessageEntityMentionName, failing with bot/bot_info
This commit is contained in:
Lonami Exo 2017-10-18 20:43:46 +02:00
parent e349910eb9
commit f49208f961

View File

@ -314,11 +314,11 @@ class TLGenerator:
for ra in repeated_args.values():
if len(ra) > 1:
cnd1 = ('self.{} is None'.format(a.name) for a in ra)
cnd2 = ('self.{} is not None'.format(a.name) for a in ra)
cnd1 = ('self.{}'.format(a.name) for a in ra)
cnd2 = ('not self.{}'.format(a.name) for a in ra)
builder.writeln(
"assert ({}) or ({}), '{} parameters must all "
"be None or neither be None'".format(
"be False-y (like None) or all me True-y''".format(
' and '.join(cnd1), ' and '.join(cnd2),
', '.join(a.name for a in ra)
)