Пример #1
0
 def test_list_assignment_with_function_call_as_value(self):
     source = parse(
         "x = 3",
         "results = [foo(x)]",
     )
     results = source.body[1]
     t = value_type(results)
     assert t == "foo(x)"
Пример #2
0
 def test_list_assignment_with_default_values(self):
     source = parse(
         "x = 3",
         "results = [x]",
     )
     results = source.body[1]
     t = value_type(results)
     assert t == "x"
Пример #3
0
 def test_assign_function(self):
     source = parse(
         "x = 3",
         "y = foo(x)",
     )
     y = source.body[1]
     t = value_type(y)
     assert t == "foo(x)"
Пример #4
0
 def test_assign_name(self):
     source = parse(
         "x = 3",
         "y = x",
     )
     y = source.body[1]
     t = value_type(y)
     assert t == "x"
Пример #5
0
 def test_global_list_assignment_with_later_append(self):
     source = parse(
         "results = []",
         "def add_x():",
         "   results.append(2)",
     )
     add_list_calls(source)
     results = source.body[0]
     t = value_type(results)
     assert t == "2"
Пример #6
0
 def test_list_assignment_with_append_unknown_value(self):
     source = parse(
         "results = []",
         "x = 3",
         "results.append(x)",
     )
     add_list_calls(source)
     results = source.body[0]
     t = value_type(results)
     assert t == "3"
Пример #7
0
 def test_list_assignment_based_on_later_append(self):
     source = parse(
         "x = 3",
         "results = []",
         "results.append(x)",
     )
     add_list_calls(source)
     results = source.body[1]
     t = value_type(results)
     assert t == "3"
Пример #8
0
 def test_direct_assignment(self):
     source = parse("x = 3")
     x = source.body[0]
     t = value_type(x)
     assert t == "3"