Beispiel #1
0
    def test_get_call_names_with_comprehension(self):
        m = ast.parse('{a for a in b()}.union(c)')
        call = m.body[0].value

        result = get_call_names_as_string(call.func)

        self.assertEqual(result, 'union')
Beispiel #2
0
    def test_get_call_names_multi(self):
        m = ast.parse('abc.defg.hi(a)')
        call = m.body[0].value

        result = get_call_names_as_string(call.func)

        self.assertEqual(result, 'abc.defg.hi')
Beispiel #3
0
    def test_get_call_names_with_binop(self):
        m = ast.parse(
            '(date.today() - timedelta(days=1)).strftime("%Y-%m-%d")')
        call = m.body[0].value

        result = get_call_names_as_string(call.func)

        self.assertEqual(result, 'strftime')