Пример #1
0
def test_sort_classes_full():
    # full
    classes = ["class Foo(Bar):", "class Bar():"]
    sorted = sort_classes(classes)
    assert sorted != None
    assert len(sorted) == len(classes)
    assert sorted[0] == "class Bar():"
    assert sorted[1] == "class Foo(Bar):"
Пример #2
0
def test_sort_classes():
    classes = [
        "class Spam(Foo)", "class Foo(Bar)", "class Bar(Parrot)",
        "class Parrot()"
    ]

    sorted = sort_classes(classes)
    assert sorted != None
    assert len(sorted) == len(classes)
    assert sorted[0] == "class Parrot()"
    assert sorted[1] == "class Bar(Parrot)"
    assert sorted[2] == "class Foo(Bar)"
    assert sorted[3] == "class Spam(Foo)"
Пример #3
0
def test_sort_classes_basic():
    # short notation without ()
    classes = ["class Foo", "class Bar"]
    sorted = sort_classes(classes)
    assert sorted != None
    assert len(sorted) == len(classes)
Пример #4
0
def test_sort_classes_empty():
    classes = []
    sorted = sort_classes(classes)
    assert sorted != None
    assert len(sorted) == len(classes)
    assert sorted == []
Пример #5
0
def test_sort_classes_1():
    classes = ["class Spam(Foo)"]
    sorted = sort_classes(classes)
    assert sorted != None
    assert len(sorted) == len(classes)
    assert sorted[0] == "class Spam(Foo)"