Skip to content

[Chore/Refactor] bring jieba keyword table handler tests under strict pyrefly #45319

Open

Description

@lianbie

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for refactors or chores; if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Description

Continuing #24645: api/tests/unit_tests/core/rag/datasource/keyword/jieba/test_jieba_keyword_table_handler.py is still listed in the project-excludes of api/tests/unit_tests/pyrefly.toml, so strict Pyrefly never checks it.

Running strict Pyrefly on the file (pyrefly 1.4.0) reports 19 diagnostics, all in the test's own declarations:

  • 10 unannotated-return: the eight test functions, _DummyTFIDF.__init__ and _install_fake_jieba_modules have no return annotation.
  • 2 implicit-any-parameter: _install_fake_jieba_modules takes an unannotated monkeypatch, and _DummyTFIDF.extract_tags takes unannotated **kwargs.
  • 7 missing-attribute: the tests install a fake jieba.analyse module and assign default_tfidf / TFIDF / analyse on a plain types.ModuleType, which declares none of them.

Nothing here is a behavior defect; the file is simply not under strict checking yet.

Reproduction (from api/):

pyrefly check --config=tests/unit_tests/pyrefly.toml \
  --use-ignore-files=false --disable-project-excludes-heuristics=true \
  tests/unit_tests/core/rag/datasource/keyword/jieba/test_jieba_keyword_table_handler.py

Expected Behavior

The module is brought under strict Pyrefly checking and removed from the exclusion list, following the pattern used by #43883, #43875 and #43798.

Actual Behavior

As described above.

Additional Context

I have a patch ready that annotates the declarations and documents the seven intentional fake-module attribute assignments with # pyrefly: ignore[missing-attribute], changes no assertion and no test logic, and removes the single exclusion entry. I will open a PR referencing this issue.

Activity

  1. Luckyou-d commented on Nov 3, 2026

    @Luckyou-d
    Contributor

    Hi! I'd like to take this issue.

    I can prepare a focused patch that removes the test file from the Pyrefly project exclusions, adds the missing annotations, and declares the attributes used by the fake jieba modules. I'll run strict Pyrefly and the focused Jieba test module to verify the change.

    Please assign the issue to @Luckyou-d if it is still available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions