# Path: matchpy/utils.py
# T = TypeVar('T')
# def fixed_integer_vector_iter(max_vector: Tuple[int, ...], vector_sum: int) -> Iterator[Tuple[int, ...]]:
# def weak_composition_iter(n: int, num_parts: int) -> Iterator[Tuple[int, ...]]:
# def optional_iter(remaining, count):
# def _make_variable_generator_factory(value, total, variables: List[VariableWithCount]):
#     def _factory(subst):
# def _commutative_single_variable_partiton_iter(values: 'Multiset[T]',
#                                                variable: VariableWithCount) -> Iterator[Dict[str, 'Multiset[T]']]:
# def commutative_sequence_variable_partition_iter(values: Multiset, variables: List[VariableWithCount]
#                                                 ) -> Iterator[Dict[str, Multiset]]:
#     def __init__(self, lines):
#     def visit(self, node):
#     def visit_Lambda(self, node):
#     def generic_visit(self, node):
# def get_short_lambda_source(lambda_func: LambdaType) -> Optional[str]:
# def extended_euclid(a: int, b: int) -> Tuple[int, int, int]:
# def base_solution_linear(a: int, b: int, c: int) -> Iterator[Tuple[int, int]]:
# def solve_linear_diop(total: int, *coeffs: int) -> Iterator[Tuple[int, ...]]:
# def generator_chain(initial_data: T, *factories: Callable[[T], Iterator[T]]) -> Iterator[T]:
#     def __init__(self, getter, slot=None):
#     def __get__(self, obj, cls):
# def slot_cached_property(slot):
#     def _wrapper(getter):
# class LambdaNodeVisitor(ast.NodeVisitor):
# class cached_property(property):


import itertools
import os
import hypothesis.strategies as st
import pytest
from hypothesis import assume, example, given, settings
from multiset import Multiset
from matchpy.utils import (
    VariableWithCount, base_solution_linear, cached_property, commutative_sequence_variable_partition_iter,
    extended_euclid, fixed_integer_vector_iter, get_short_lambda_source, weak_composition_iter, slot_cached_property,
    solve_linear_diop
)
        solutions = list(base_solution_linear(a, b, c))
        assert is_unique_list(solutions), "Duplicate solution found"

    @pytest.mark.parametrize(
        '   a,      b,      c',
        [
            (0,     1,      1),
            (-1,    1,      1),
            (1,     0,      1),
            (1,     -1,     1),
            (1,     1,      -1),
        ]
    )  # yapf: disable
    def test_error(self, a, b, c):
        with pytest.raises(ValueError):
            next(base_solution_linear(a, b, c))


class TestIntegerPartitionVectorIter:
    @pytest.mark.parametrize('n', range(0, 11))
    @pytest.mark.parametrize('m', range(0, 4))
    def test_correctness(self, n, m):
        for part in weak_composition_iter(n, m):
            assert all(p >= 0 for p in part)
            assert sum(part) == n
            assert len(part) == m

    @pytest.mark.parametrize('n', range(0, 11))
    @pytest.mark.parametrize('m', range(0, 4))
    def test_completeness_and_uniqueness(self, n, m):

# Path: matchpy/utils.py
# T = TypeVar('T')
# def fixed_integer_vector_iter(max_vector: Tuple[int, ...], vector_sum: int) -> Iterator[Tuple[int, ...]]:
# def weak_composition_iter(n: int, num_parts: int) -> Iterator[Tuple[int, ...]]:
# def optional_iter(remaining, count):
# def _make_variable_generator_factory(value, total, variables: List[VariableWithCount]):
#     def _factory(subst):
# def _commutative_single_variable_partiton_iter(values: 'Multiset[T]',
#                                                variable: VariableWithCount) -> Iterator[Dict[str, 'Multiset[T]']]:
# def commutative_sequence_variable_partition_iter(values: Multiset, variables: List[VariableWithCount]
#                                                 ) -> Iterator[Dict[str, Multiset]]:
#     def __init__(self, lines):
#     def visit(self, node):
#     def visit_Lambda(self, node):
#     def generic_visit(self, node):
# def get_short_lambda_source(lambda_func: LambdaType) -> Optional[str]:
# def extended_euclid(a: int, b: int) -> Tuple[int, int, int]:
# def base_solution_linear(a: int, b: int, c: int) -> Iterator[Tuple[int, int]]:
# def solve_linear_diop(total: int, *coeffs: int) -> Iterator[Tuple[int, ...]]:
# def generator_chain(initial_data: T, *factories: Callable[[T], Iterator[T]]) -> Iterator[T]:
#     def __init__(self, getter, slot=None):
#     def __get__(self, obj, cls):
# def slot_cached_property(slot):
#     def _wrapper(getter):
# class LambdaNodeVisitor(ast.NodeVisitor):
# class cached_property(property):


# Path: tests/test_utils.py
import itertools
import os
import hypothesis.strategies as st
import pytest
from hypothesis import assume, example, given, settings
from multiset import Multiset
from matchpy.utils import (
    VariableWithCount, base_solution_linear, cached_property, commutative_sequence_variable_partition_iter,
    extended_euclid, fixed_integer_vector_iter, get_short_lambda_source, weak_composition_iter, slot_cached_property,
    solve_linear_diop
)

        solutions = list(base_solution_linear(a, b, c))
        assert is_unique_list(solutions), "Duplicate solution found"

    @pytest.mark.parametrize(
        '   a,      b,      c',
        [
            (0,     1,      1),
            (-1,    1,      1),
            (1,     0,      1),
            (1,     -1,     1),
            (1,     1,      -1),
        ]
    )  # yapf: disable
    def test_error(self, a, b, c):
        with pytest.raises(ValueError):
            next(base_solution_linear(a, b, c))


class TestIntegerPartitionVectorIter:
    @pytest.mark.parametrize('n', range(0, 11))
    @pytest.mark.parametrize('m', range(0, 4))
    def test_correctness(self, n, m):
        for part in weak_composition_iter(n, m):
            assert all(p >= 0 for p in part)
            assert sum(part) == n
            assert len(part) == m

    @pytest.mark.parametrize('n', range(0, 11))
    @pytest.mark.parametrize('m', range(0, 4))
    def test_completeness_and_uniqueness(self, n, m):

        solutions = set(weak_composition_iter(n, m))