From f49208f96179fb775e9d32c23bb2ba66bc6a5935 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 18 Oct 2017 20:43:46 +0200 Subject: [PATCH] Fix assert condition on generated code with flags involved The specific case was SendMessageRequest with InputMessageEntityMentionName, failing with bot/bot_info --- telethon_generator/tl_generator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/telethon_generator/tl_generator.py b/telethon_generator/tl_generator.py index fde3cd22..5ee12969 100644 --- a/telethon_generator/tl_generator.py +++ b/telethon_generator/tl_generator.py @@ -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) )