diff --git a/tests/version_compat/test_bitsandbytes_pinned_symbols.py b/tests/version_compat/test_bitsandbytes_pinned_symbols.py index a615641523..6e1892767b 100644 --- a/tests/version_compat/test_bitsandbytes_pinned_symbols.py +++ b/tests/version_compat/test_bitsandbytes_pinned_symbols.py @@ -47,12 +47,10 @@ def test_bnb_functional_4bit(tag: str): "bitsandbytes/functional.py", "bitsandbytes/functional/__init__.py", ] - hit = first_match( - "bitsandbytes-foundation/bitsandbytes", tag, candidates - ) - assert hit is not None, ( - f"{tag}: bitsandbytes/functional[.py|/__init__.py] both missing" - ) + hit = first_match("bitsandbytes-foundation/bitsandbytes", tag, candidates) + assert ( + hit is not None + ), f"{tag}: bitsandbytes/functional[.py|/__init__.py] both missing" _, src = hit needed = ("dequantize_4bit", "quantize_4bit") missing = [n for n in needed if not has_def(src, n, "func") and n not in src] diff --git a/tests/version_compat/test_peft_pinned_symbols.py b/tests/version_compat/test_peft_pinned_symbols.py index d7ed6de65b..da6868fbad 100644 --- a/tests/version_compat/test_peft_pinned_symbols.py +++ b/tests/version_compat/test_peft_pinned_symbols.py @@ -87,9 +87,7 @@ def test_peft_lora_config_class(tag: str): src = fetch_text("huggingface/peft", tag, p) if src is not None and has_def(src, "LoraConfig", "class"): found_in.append(p) - assert found_in, ( - f"{tag}: peft.tuners.lora.LoraConfig not in any of {candidates}" - ) + assert found_in, f"{tag}: peft.tuners.lora.LoraConfig not in any of {candidates}" # ------------------------------------------------------------------------- @@ -111,9 +109,7 @@ def test_get_peft_model_function(tag: str): src = fetch_text("huggingface/peft", tag, p) if src is not None and has_def(src, "get_peft_model", "func"): return - pytest.fail( - f"{tag}: def get_peft_model(...) not found in any of {candidates}" - ) + pytest.fail(f"{tag}: def get_peft_model(...) not found in any of {candidates}") # ------------------------------------------------------------------------- diff --git a/tests/version_compat/test_sentence_transformers_pinned_symbols.py b/tests/version_compat/test_sentence_transformers_pinned_symbols.py index afb11ad224..2a8c33827c 100644 --- a/tests/version_compat/test_sentence_transformers_pinned_symbols.py +++ b/tests/version_compat/test_sentence_transformers_pinned_symbols.py @@ -50,10 +50,10 @@ ST_TAGS = [ @pytest.mark.parametrize("tag", ST_TAGS) def test_st_top_level_exports(tag: str): - src = fetch_text("UKPLab/sentence-transformers", tag, "sentence_transformers/__init__.py") - assert src is not None, ( - f"{tag}: sentence_transformers/__init__.py missing" + src = fetch_text( + "UKPLab/sentence-transformers", tag, "sentence_transformers/__init__.py" ) + assert src is not None, f"{tag}: sentence_transformers/__init__.py missing" needed = ("SentenceTransformer", "SentenceTransformerTrainer") missing = [n for n in needed if n not in src] assert not missing, ( @@ -192,9 +192,9 @@ def test_st_util_helpers(tag: str): "sentence_transformers/util/__init__.py", ] hit = first_match("UKPLab/sentence-transformers", tag, candidates) - assert hit is not None, ( - f"{tag}: sentence_transformers/util[.py|/__init__.py] both missing" - ) + assert ( + hit is not None + ), f"{tag}: sentence_transformers/util[.py|/__init__.py] both missing" _path, src = hit for fn in ("import_from_string", "load_dir_path"): defined_here = has_def(src, fn, "func") diff --git a/tests/version_compat/test_trl_grpo_pinned_symbols.py b/tests/version_compat/test_trl_grpo_pinned_symbols.py index ccf64f2c19..f5c373e76c 100644 --- a/tests/version_compat/test_trl_grpo_pinned_symbols.py +++ b/tests/version_compat/test_trl_grpo_pinned_symbols.py @@ -97,9 +97,9 @@ def test_grpo_trainer_class_canonical_path(tag: str): f"{tag}: trl/trainer/grpo_trainer.py missing — " f"unsloth.models.rl._patch_trl_rl_trainers('grpo_trainer') breaks" ) - assert has_def(src, "GRPOTrainer", "class"), ( - f"{tag}: trl.trainer.grpo_trainer.GRPOTrainer not defined as a class" - ) + assert has_def( + src, "GRPOTrainer", "class" + ), f"{tag}: trl.trainer.grpo_trainer.GRPOTrainer not defined as a class" @pytest.mark.parametrize("tag", TRL_TAGS) @@ -211,9 +211,7 @@ def test_trl_experimental_openenv_gated(tag: str): pytest.skip(f"{tag}: trl.experimental.openenv not present (OK)") # Module exists -> at minimum, `utils` submodule must be importable # because unsloth patches via `import trl.experimental.openenv.utils`. - utils_src = fetch_text( - "huggingface/trl", tag, "trl/experimental/openenv/utils.py" - ) + utils_src = fetch_text("huggingface/trl", tag, "trl/experimental/openenv/utils.py") assert utils_src is not None, ( f"{tag}: trl.experimental.openenv exists but utils.py missing; " f"unsloth/models/rl_replacements.py:1765 imports openenv.utils explicitly" @@ -273,7 +271,7 @@ def test_trl_version_parseable(tag: str): src, re.MULTILINE, ) - and re.search(r'^\s*__version__\s*=\s*version\s*\(', src, re.MULTILINE) + and re.search(r"^\s*__version__\s*=\s*version\s*\(", src, re.MULTILINE) ) assert has_literal or has_subimport or has_metadata, ( f"{tag}: trl.__version__ not exported via any known mechanism; "