Did I find the right examples for you? yes no

All Samples(21)  |  Call(11)  |  Derive(0)  |  Import(10)
An (abstract) category.

A category [JoyOfCats] is a quadruple `\mbox{K} = (O, \hom, id,
\circ)` consisting of

* a (set-theoretical) class `O`, whose members are called
  `K`-objects,

* for each pair `(A, B)` of `K`-objects, a set `\hom(A, B)` whose
  members are called `K`-morphisms from `A` to `B`,(more...)

src/s/y/sympy-HEAD/sympy/categories/tests/test_baseclasses.py   sympy(Download)
from sympy.categories import (Object, Morphism, IdentityMorphism,
                              NamedMorphism, CompositeMorphism,
                              Diagram, Category)
from sympy.categories.baseclasses import Class
from sympy.utilities.pytest import XFAIL, raises
    objects = d1.objects | d2.objects
 
    K = Category("K", objects, commutative_diagrams=[d1, d2])
 
    assert K.name == "K"
    assert K.objects == Class(objects)
    assert K.commutative_diagrams == FiniteSet(d1, d2)
 
    raises(ValueError, lambda: Category(""))

src/s/y/sympy-0.7.5/sympy/categories/tests/test_baseclasses.py   sympy(Download)
from sympy.categories import (Object, Morphism, IdentityMorphism,
                              NamedMorphism, CompositeMorphism,
                              Diagram, Category)
from sympy.categories.baseclasses import Class
from sympy.utilities.pytest import XFAIL, raises
    objects = d1.objects | d2.objects
 
    K = Category("K", objects, commutative_diagrams=[d1, d2])
 
    assert K.name == "K"
    assert K.objects == Class(objects)
    assert K.commutative_diagrams == FiniteSet(d1, d2)
 
    raises(ValueError, lambda: Category(""))

src/s/y/sympy-HEAD/sympy/core/tests/test_args.py   sympy(Download)
def test_sympy__categories__baseclasses__Diagram():
    from sympy.categories import Object, NamedMorphism, Diagram, Category
    A = Object("A")
    B = Object("B")
    C = Object("C")
def test_sympy__categories__baseclasses__Category():
    from sympy.categories import Object, NamedMorphism, Diagram, Category
    A = Object("A")
    B = Object("B")
    C = Object("C")
    f = NamedMorphism(A, B, "f")
    g = NamedMorphism(B, C, "g")
    d1 = Diagram([f, g])
    d2 = Diagram([f])
    K = Category("K", commutative_diagrams=[d1, d2])
    d2 = Diagram([f])
    K = Category("K", commutative_diagrams=[d1, d2])
    assert _test_args(K)
 
def test_sympy__ntheory__factor___totient():

src/s/y/sympy-HEAD/sympy/printing/pretty/tests/test_pretty.py   sympy(Download)
def test_categories():
    from sympy.categories import (Object, IdentityMorphism,
        NamedMorphism, Category, Diagram, DiagramGrid)
 
    A1 = Object("A1")
    id_A1 = IdentityMorphism(A1)
 
    K1 = Category("K1")
 
    assert pretty(A1) == "A1"
    assert upretty(f2*f1) == u("f₂∘f₁:A₁——▶A₃")
 
    assert pretty(K1) == "K1"
    assert upretty(K1) == u("K₁")
 

src/s/y/sympy-0.7.5/sympy/printing/pretty/tests/test_pretty.py   sympy(Download)
def test_categories():
    from sympy.categories import (Object, IdentityMorphism,
        NamedMorphism, Category, Diagram, DiagramGrid)
 
    A1 = Object("A1")
    id_A1 = IdentityMorphism(A1)
 
    K1 = Category("K1")
 
    assert pretty(A1) == "A1"
    assert upretty(f2*f1) == u("f₂∘f₁:A₁——▶A₃")
 
    assert pretty(K1) == "K1"
    assert upretty(K1) == u("K₁")
 

src/s/y/sympy-HEAD/sympy/printing/tests/test_latex.py   sympy(Download)
def test_categories():
    from sympy.categories import (Object, IdentityMorphism,
        NamedMorphism, Category, Diagram, DiagramGrid)
 
    A1 = Object("A1")
    id_A1 = IdentityMorphism(A1)
 
    K1 = Category("K1")
 
    assert latex(A1) == "A_{1}"
    assert latex(f1) == "f_{1}:A_{1}\\rightarrow A_{2}"
    assert latex(id_A1) == "id:A_{1}\\rightarrow A_{1}"
    assert latex(f2*f1) == "f_{2}\\circ f_{1}:A_{1}\\rightarrow A_{3}"
 
    assert latex(K1) == "\mathbf{K_{1}}"

src/s/y/sympy-0.7.5/sympy/printing/tests/test_latex.py   sympy(Download)
def test_categories():
    from sympy.categories import (Object, IdentityMorphism,
        NamedMorphism, Category, Diagram, DiagramGrid)
 
    A1 = Object("A1")
    id_A1 = IdentityMorphism(A1)
 
    K1 = Category("K1")
 
    assert latex(A1) == "A_{1}"
    assert latex(f1) == "f_{1}:A_{1}\\rightarrow A_{2}"
    assert latex(id_A1) == "id:A_{1}\\rightarrow A_{1}"
    assert latex(f2*f1) == "f_{2}\\circ f_{1}:A_{1}\\rightarrow A_{3}"
 
    assert latex(K1) == "\mathbf{K_{1}}"

src/s/y/sympy-HEAD/sympy/printing/tests/test_str.py   sympy(Download)
def test_categories():
    from sympy.categories import (Object, NamedMorphism,
        IdentityMorphism, Category)
 
    A = Object("A")
    id_A = IdentityMorphism(A)
 
    K = Category("K")
 
    assert str(A) == 'Object("A")'
    assert str(f) == 'NamedMorphism(Object("A"), Object("B"), "f")'
    assert str(id_A) == 'IdentityMorphism(Object("A"))'
 
    assert str(K) == 'Category("K")'

src/s/y/sympy-0.7.5/sympy/printing/tests/test_str.py   sympy(Download)
def test_categories():
    from sympy.categories import (Object, NamedMorphism,
        IdentityMorphism, Category)
 
    A = Object("A")
    id_A = IdentityMorphism(A)
 
    K = Category("K")
 
    assert str(A) == 'Object("A")'
    assert str(f) == 'NamedMorphism(Object("A"), Object("B"), "f")'
    assert str(id_A) == 'IdentityMorphism(Object("A"))'
 
    assert str(K) == 'Category("K")'