Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Update tests/test_litellm/litellm_core_utils/test_token_counter.py

jquinterafbfbf3cae05
diff --git a/tests/test_litellm/litellm_core_utils/test_token_counter.py b/tests/test_litellm/litellm_core_utils/test_token_counter.py
index f23317eea4a..a562e724665 100644
--- a/tests/test_litellm/litellm_core_utils/test_token_counter.py
+++ b/tests/test_litellm/litellm_core_utils/test_token_counter.py
@@ -213,10 +213,11 @@ def test_tokenizers():
# llama2 may fall back to the tiktoken tokenizer when the HuggingFace
# model hub is unreachable (e.g. in CI). In that case the count will
# equal the openai count and the differentiation assertion is skipped.
- if openai_tokens != llama2_tokens:
- assert (
- llama2_tokens != llama3_tokens_1
- ), "Token values are not different."
+ if openai_tokens == llama2_tokens:
+ pytest.skip("llama2 fell back to tiktoken (HF hub unreachable); skipping differentiation assertion")
+ assert (
+ llama2_tokens != llama3_tokens_1
+ ), "Token values are not different."
assert (
llama3_tokens_1 == llama3_tokens_2