Skip to content

Commit

Permalink
More fixes + run on PRs (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
marctorsoc authored Oct 13, 2024
1 parent 32966ca commit f4f53ab
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
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

0 comments on commit f4f53ab

Please sign in to comment.