本文整理匯總了Python中clld.db.models.common.Language.name方法的典型用法代碼示例。如果您正苦於以下問題:Python Language.name方法的具體用法?Python Language.name怎麽用?Python Language.name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類clld.db.models.common.Language
的用法示例。
在下文中一共展示了Language.name方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_Versioning
# 需要導入模塊: from clld.db.models.common import Language [as 別名]
# 或者: from clld.db.models.common.Language import name [as 別名]
def test_Versioning(self):
from clld.db.models.common import Language, Identifier, LanguageIdentifier
from clld.db.meta import VersionedDBSession
l = Language(id='abc', name='Old Name', jsondata={'i': 2})
VersionedDBSession.add(l)
VersionedDBSession.flush()
self.assertEqual(l.version, 1)
l.name = 'New Name'
l.description = 'New Description'
VersionedDBSession.flush()
self.assertEqual(l.version, 2)
History = l.__history_mapper__.class_
res = VersionedDBSession.query(History).filter(History.pk == l.pk).all()
self.assertEqual(res[0].name, 'Old Name')
li = LanguageIdentifier(
identifier=Identifier(id='asd', type='wals'),
language=l)
VersionedDBSession.flush()
VersionedDBSession.delete(li)
VersionedDBSession.delete(l)
VersionedDBSession.flush()
示例2: test_Versioning
# 需要導入模塊: from clld.db.models.common import Language [as 別名]
# 或者: from clld.db.models.common.Language import name [as 別名]
def test_Versioning(self):
from clld.db.models.common import Language, Language_data
from clld.db.meta import VersionedDBSession
l = Language(id='abc', name='Old Name', jsondata={'i': 2})
VersionedDBSession.add(l)
VersionedDBSession.flush()
self.assertEqual(l.version, 1)
l.name = 'New Name'
l.description = 'New Description'
VersionedDBSession.flush()
self.assertEqual(l.version, 2)
History = l.__history_mapper__.class_
res = VersionedDBSession.query(History).filter(History.pk == l.pk).all()
self.assertEqual(res[0].name, 'Old Name')
l.data.append(Language_data(key='k', value='v'))
VersionedDBSession.flush()
assert l.datadict()
VersionedDBSession.delete(l)
VersionedDBSession.flush()