human
I wrote the below code

    ip = get_ipython()
    complete = ip.Completer.complete
    d = {'abc': None}
    ip.user_ns['d'] = d
    class C:
        data = d
    ip.user_ns['C'] = C
    ip.user_ns['get'] = (lambda : d)
    def assert_no_completion(**kwargs):
        (_, matches) = complete(**kwargs)
        nt.assert_not_in('abc', matches)
        nt.assert_not_in("abc'", matches)
        nt.assert_not_in("abc']", matches)
        nt.assert_not_in("'abc'", matches)
        nt.assert_not_in("'abc']", matches)
    def assert_completion(**kwargs):
        (_, matches) = complete(**kwargs)
        nt.assert_in("'abc'", matches)
        nt.assert_not_in("'abc']", matches)
    assert_no_completion(line_buffer="d['a'")
    assert_no_completion(line_buffer='d["a"')
    assert_no_completion(line_buffer="d['a'    +    ")
    assert_no_completion(line_buffer="d['a'    +    '")
    assert_completion(line_buffer='+    d[')
    assert_completion(line_buffer='(d[')
    assert_completion(line_buffer='C.data[')
    def assert_completion(**kwargs):
        (_, matches) = complete(**kwargs)
        nt.assert_in("get()['abc']", matches)
    assert_no_completion(line_buffer='get()[')
    with greedy_completion():
        assert_completion(line_buffer='get()[')
        assert_completion(line_buffer="get()['")
        assert_completion(line_buffer="get()['a")
        assert_completion(line_buffer="get()['ab")
        assert_completion(line_buffer="get()['abc")

What's a good function header?
assistant
#Here's a good function header.

def test_dict_key_completion_contexts():