calculate team sizes - Warzone - duos In call of Duty warzone, there is a Duos mode (Teams of two). As the game progresses and people are eliminated some teams might have just one player left and some still with two. The game tells you the number of players left and the number of teams. For example, 5 players left, 3 teams left. In this case we can know that this will be two teams of 2, and one team of 1.
Anyway I worked out a formula for calculating the number of teams with 1 or 2 players. below is a short code and some test cases I would appreciate any review / feedback on.
source code
from typing import Tuple


def team_counts(players: int, teams: int) -&gt; Tuple[int, int]:
    if players &lt;= 0 or teams &lt;= 0:
        raise ValueError(f&quot;{players=}, {teams=} - Players and teams must be a positive value&quot;)
    if teams &gt; players or teams &lt; players / 2:
        raise ValueError(f&quot;{players=}, {teams=} - Teams must be less than players and greater than or equal to half of players&quot;)
    twos = players - teams
    ones = teams - twos
    return ones, twos

Test code
from teams_of_two import team_counts
import pytest


def test_players_teams_positive():
    assert team_counts(players=1, teams=1) == (1, 0)


def test_players_negative_teams_positive():
    with pytest.raises(ValueError):
        team_counts(players=-1, teams=1)


def test_players_positive_teams_negative():
    with pytest.raises(ValueError):
        team_counts(players=1, teams=-1)


def test_players_zero_teams_positive():
    with pytest.raises(ValueError):
        team_counts(players=0, teams=1)


def test_players_positive_teams_zero():
    with pytest.raises(ValueError):
        team_counts(players=1, teams=0)


def test_to_many_teams():
    with pytest.raises(ValueError):
        team_counts(players=1, teams=2)
Good job overall. You're developing good habits: you're testing your code, you've used the type annotations, you're using f-strings.
If I were to be nit-picky, here's what I'd still suggest:

some of your lines are too long and I have to horizontally scroll to see everything. try to shorten them as specified in PEP8
add a docstrings to your function
function names are usually describing an action so you should be calling yours something like: def count_teams() - I'm really bad at naming things but you got my point

The final code would look like this:
from typing import Tuple


def count_teams(players: int, teams: int) -&gt; Tuple[int, int]:
    &quot;&quot;&quot;
    Calculate the number of teams with 1 or 2 players
    in call of Duty WarZone (Duos mode)
    &quot;&quot;&quot;

    if players &lt;= 0 or teams &lt;= 0:
        raise ValueError(f&quot;{players=}, {teams=} - Players and &quot;
                         f&quot;teams must be a positive value&quot;)

    if teams &gt; players or teams &lt; players / 2: 
        raise ValueError(f&quot;{players=}, {teams=} - Teams must be &quot;
                         f&quot;less than players and greater than or&quot;
                         f&quot; equal to half of players&quot;)

    twos = players - teams
    ones = teams - twos

    return ones, twos

As far as your tests go, the only thing you could improve is to parametrize the tests that are the same but use different values. You have on the pytest's official docs some examples.
And another small nit-pick would be to first import the 3rd party libraries and then the local ones, with a blank line between each group:
import pytest

from teams_of_two import team_counts


# tests ...

LE: edited the chain comparison advice which wasn’t applicable in this case.