Beispiel #1
0
def test_sortclass_str(tmp):
    sort_obj = fancyindex.DirEntry(tmp['dir'], 'test')

    assert str(sort_obj) == 'test'

    sort_obj = fancyindex.DirEntry(tmp['dir'], 'testdir')

    assert str(sort_obj) == 'testdir/'
Beispiel #2
0
def test_sortclass_eq(tmp):
    sort_obj1 = fancyindex.DirEntry(tmp['dir'], 'test')
    sort_obj2 = fancyindex.DirEntry(tmp['dir'], 'test')

    assert sort_obj1 == sort_obj2

    sort_obj3 = fancyindex.DirEntry(tmp['dir'], 'Test')

    assert not sort_obj1 == sort_obj3

    sort_obj4 = fancyindex.DirEntry(tmp['dir'], 'tmp')
    sort_obj5 = fancyindex.DirEntry(os.path.join(tmp['dir'], 'tmp'), 'tmp')

    assert not sort_obj4 == sort_obj5
Beispiel #3
0
def test_sortclass_repr(tmp):
    sort_obj = fancyindex.DirEntry(tmp['dir'], 'test')

    sort_repr = repr(sort_obj)
    assert 'DirEntry' in sort_repr
    assert repr(tmp['dir']) in sort_repr
    assert repr('test') in sort_repr
Beispiel #4
0
def test_sortclass_lt(tmp):
    sort_obj1 = fancyindex.DirEntry(tmp['dir'], 'test')
    sort_obj2 = fancyindex.DirEntry(tmp['dir'], 'test')

    assert not sort_obj1 < sort_obj2

    sort_obj3 = fancyindex.DirEntry(tmp['dir'], 'Test')

    assert sort_obj3 < sort_obj2

    sort_obj4 = fancyindex.DirEntry(tmp['dir'], 'tmp')
    sort_obj5 = fancyindex.DirEntry(os.path.join(tmp['dir'], 'tmp'), 'tmp')

    assert sort_obj4 < sort_obj5

    sort_obj6 = fancyindex.DirEntry(os.path.join(tmp['dir'], 'tmp'), 'test')
    sort_obj7 = fancyindex.DirEntry(os.path.join(tmp['dir'], 'Tmp'), 'test')

    assert sort_obj7 < sort_obj6
Beispiel #5
0
def test_sortclass_trailing_slash(tmp):
    sort_obj = fancyindex.DirEntry(tmp['dir'], 'testdir')

    assert sort_obj.filename.endswith('/')