Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More fixes + run on PRs #7

Merged
merged 3 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
workflow_dispatch:
pull_request:

jobs:
build:
Expand All @@ -29,7 +30,7 @@ jobs:
flake8 . --max-line-length=127
- name: Check formatting with Black
run: |
black --check .
black --check --diff .
- name: Static type checking
run: |
mypy .
Expand Down
1 change: 1 addition & 0 deletions tests/dummy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
tokens in case of an LLM API - and the number of tokens used would only be known after the
request is processed.
"""

import asyncio
import json
import random
Expand Down
1 change: 1 addition & 0 deletions tests/test_calls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Intended to test the calls module - not performing actual calls to any API"""

from rate_limited.calls import Call


Expand Down
8 changes: 1 addition & 7 deletions tests/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,9 @@ def random_client(url: str, how_many=2, failure_proba: float = 0.2) -> dict:

def validate_num_x_2(result: dict) -> bool:
return result["output"].count("x") == 2


def validate_starts_with_x(result: dict) -> bool:
return result["output"].startswith("x")


validation = validate_num_x_2
if add_extra_validator:
Expand All @@ -298,11 +296,7 @@ def validate_starts_with_x(result: dict) -> bool:
outputs = [result["output"] for result in results]
assert outputs == ["xx"] * num_requests

exceptions_flat = [
e
for sublist in exceptions
for e in sublist
]
exceptions_flat = [e for sublist in exceptions for e in sublist]
assert any(isinstance(e, ValidationError) for e in exceptions_flat)


Expand Down
Loading