Fix handling of tests which check constants

Because of how the parser works, it does not differentiate between
constants and function names, so this needs to convert it back.
This commit is contained in:
Kevin Brown 2020-05-14 20:04:57 -04:00
parent e5d018fdef
commit 23a145dc2d

View File

@ -558,6 +558,14 @@ def parse_conditional_expression_test(ast):
kwargs = call.kwargs
dynamic_args = call.dyn_args
dynamic_kwargs = call.dyn_kwargs
elif isinstance(test_function, nodes.Const):
const_map = {
None: 'none',
True: 'true',
False: 'false',
}
name = const_map[test_function.value]
else:
name = test_function.name