示例#1
0
def test_itersubclasses():
    class A(object):
        pass

    class Aa(A):
        pass

    class Ab(A):
        pass

    class Aaa(Aa):
        pass

    class OldStyleClass:
        pass

    name = lambda x: x.__name__
    assert_equal(list(map(name, u.itersubclasses(A))), ['Aa', 'Aaa', 'Ab'])

    if six.PY2:
        with assert_raises(TypeError):
            list(u.itersubclasses(OldStyleClass))
示例#2
0
def test_itersubclasses():
    class A:
        pass

    class Aa(A):
        pass

    class Ab(A):
        pass

    class Aaa(Aa):
        pass

    name = lambda x: x.__name__
    assert list(map(name, u.itersubclasses(A))) == ["Aa", "Aaa", "Ab"]
示例#3
0
def test_itersubclasses():
    class A:
        pass

    class Aa(A):
        pass

    class Ab(A):
        pass

    class Aaa(Aa):
        pass

    name = lambda x: x.__name__
    assert_equal(list(map(name, u.itersubclasses(A))), ['Aa', 'Aaa', 'Ab'])
示例#4
0
def test_itersubclasses_from_type():
    list(u.itersubclasses(type))