Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Python/Sympy/sympy/matrices/expressions/tests/   (The Python Language ©)  Datei vom 6.10.2026 mit Größe 4 kB image not shown  

SSL test_tools.py   Interaktion und
PortierbarkeitPython

 

from __future__ import annotations
from sympy.strategies.branch.tools import canon
from sympy.core.basic import Basic
from sympy.core.numbers import Integer
from sympy.core.singleton import S


def posdec(x):
    if isinstance(x, Integer) and x > 0:
        yield x - 1
    else:
        yield x


def branch5(x):
    if isinstance(x, Integer):
        if 0 < x < 5:
            yield x - 1
        elif 5 < x < 10:
            yield x + 1
        elif x == 5:
            yield x + 1
            yield x - 1
        else:
            yield x


def test_zero_ints():
    expr = Basic(S(2), Basic(S(5), S(3)), S(8))
    expected = {Basic(S(0), Basic(S(0), S(0)), S(0))}

    brl = canon(posdec)
    assert set(brl(expr)) == expected


def test_split5():
    expr = Basic(S(2), Basic(S(5), S(3)), S(8))
    expected = {
        Basic(S(0), Basic(S(0), S(0)), S(10)),
        Basic(S(0), Basic(S(10), S(0)), S(10))}

    brl = canon(branch5)
    assert set(brl(expr)) == expected

Messung
CHZG
929410095

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.3Angebot  (Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-11-24) ¤

*Eine klare Vorstellung vom Zielzustand