Пример #1
0
def test_naming_shallow():
    root = String(name=u's')
    assert root.fq_name() == u'.'
    assert root.flattened_name() == u's'
    assert root.el(u'.') is root

    root = String(name=None)
    assert root.fq_name() == u'.'
    assert root.flattened_name() == u''
    assert root.el(u'.') is root
    assert_raises(LookupError, root.el, ())
    assert root.el([Root]) is root
Пример #2
0
def test_naming_shallow():
    root = String(name=u's')
    assert root.fq_name() == u'.'
    assert root.flattened_name() == u's'
    assert root.el(u'.') is root

    root = String(name=None)
    assert root.fq_name() == u'.'
    assert root.flattened_name() == u''
    assert root.el(u'.') is root
    assert_raises(LookupError, root.el, ())
    assert root.el([Root]) is root
Пример #3
0
def test_naming_bogus():
    e = String(name=u's')

    assert e.el(u'.') is e
    assert_raises(LookupError, e.el, u'')
    assert_raises(TypeError, e.el, None)
    assert_raises(LookupError, e.el, ())
    assert_raises(LookupError, e.el, iter(()))
    assert_raises(TypeError, e.el)
Пример #4
0
def test_naming_bogus():
    e = String(name=u's')

    assert e.el(u'.') is e
    assert_raises(LookupError, e.el, u'')
    assert_raises(TypeError, e.el, None)
    assert_raises(LookupError, e.el, ())
    assert_raises(LookupError, e.el, iter(()))
    assert_raises(TypeError, e.el)
Пример #5
0
def test_naming_bogus():
    e = String(name=u's')

    assert e.el(u'.') is e
    with pytest.raises(LookupError):
        e.el(u'')
    with pytest.raises(TypeError):
        e.el(None)
    with pytest.raises(LookupError):
        e.el(())
    with pytest.raises(LookupError):
        e.el(iter(()))
    with pytest.raises(TypeError):
        e.el()