def testBasicIfElif(self): expected_string = """if True: pass elif False: pass """ expected_node = GetNodeFromInput(expected_string) test_node = create_node.If( create_node.Name('True'), orelse=[create_node.If(create_node.Name('False'))]) self.assertNodesEqual(expected_node, test_node)
def testIfAndOthersInElse(self): expected_string = """if True: pass else: if False: pass True """ expected_node = GetNodeFromInput(expected_string) test_node = create_node.If( create_node.Name('True'), orelse=[ create_node.If(create_node.Name('False')), create_node.Expr(create_node.Name('True')) ]) self.assertNodesEqual(expected_node, test_node)
def testBasicIf(self): expected_string = """if True:\n pass""" expected_node = GetNodeFromInput(expected_string) test_node = create_node.If(create_node.Name('True')) self.assertNodesEqual(expected_node, test_node)