def test_function_score_with_single_function():
    d = {
      'function_score': {
        'filter': {"term": {"tags": "python"}},
        'script_score': {
            'script': "doc['comment_count'] * _score"
        }
      }
    }

    q = query.Q(d)
    assert isinstance(q, query.FunctionScore)
    assert isinstance(q.filter, query.Term)
    assert len(q.functions) == 1

    sf = q.functions[0]
    assert isinstance(sf, function.ScriptScore)
    assert "doc['comment_count'] * _score" == sf.script
dataset/ETHPy150Open elastic/elasticsearch-dsl-py/test_elasticsearch_dsl/test_query.py/test_function_score_with_single_function/original