Exemplo n.º 1
0
def test_string_mapping(session):
    item = session.query(tables.Item).filter_by(identifier=u"jade-orb").one()
    assert len(item.name_map) == len(item.names)
    for lang in item.names:
        assert item.name_map[lang] == item.names[lang].name
        assert lang in item.name_map
    assert "language that doesn't exist" not in item.name_map
    assert tables.Language() not in item.name_map
Exemplo n.º 2
0
def test_new_language(session):
    item = session.query(tables.Item).filter_by(identifier=u"jade-orb").one()
    language = tables.Language()
    language.id = -1
    language.identifier = u'test'
    language.iso639 = language.iso3166 = u'--'
    language.official = False
    session.add(language)
    item.name_map[language] = u"foo"
    assert item.name_map[language] == "foo"
    assert language in item.name_map
    item.name_map[language] = u"xyzzy"
    assert item.name_map[language] == "xyzzy"