當前位置: 首頁>>代碼示例>>Python>>正文


Python Language.history方法代碼示例

本文整理匯總了Python中clld.db.models.common.Language.history方法的典型用法代碼示例。如果您正苦於以下問題:Python Language.history方法的具體用法?Python Language.history怎麽用?Python Language.history使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在clld.db.models.common.Language的用法示例。


在下文中一共展示了Language.history方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_Base

# 需要導入模塊: from clld.db.models.common import Language [as 別名]
# 或者: from clld.db.models.common.Language import history [as 別名]
    def test_Base(self):
        l = Language(id='abc', name='Name')
        VersionedDBSession.add(l)
        VersionedDBSession.flush()
        VersionedDBSession.expunge(l)
        l = Language.get('abc')
        self.assertEqual(l.name, 'Name')
        assert not list(l.history())

        # a bit of a hack to test the human readable representations.
        # we exploit the fact, that on py2, string and unicode comparison does type
        # coercion, while on py3, the two methods should actually return the same string.
        self.assertEqual(l.__str__(), l.__unicode__())
        Language().__str__()
開發者ID:Woseseltops,項目名稱:clld,代碼行數:16,代碼來源:test_db_meta.py

示例2: test_Base

# 需要導入模塊: from clld.db.models.common import Language [as 別名]
# 或者: from clld.db.models.common.Language import history [as 別名]
def test_Base(db):
    l = Language(id='abc', name='Name')
    VersionedDBSession.add(l)
    VersionedDBSession.flush()
    VersionedDBSession.expunge(l)
    l = Language.get('abc', session=VersionedDBSession)
    assert l.name == 'Name'
    assert not list(l.history())

    # a bit of a hack to test the human readable representations.
    # we exploit the fact, that on py2, string and unicode comparison does type
    # coercion, while on py3, the two methods should actually return the same string.
    assert l.__str__() == l.__unicode__()
    Language().__str__()
    assert repr(l) == "<Language 'abc'>" if PY3 else "<Language u'abc'>"
開發者ID:clld,項目名稱:clld,代碼行數:17,代碼來源:test_db_meta.py

示例3: test_Base

# 需要導入模塊: from clld.db.models.common import Language [as 別名]
# 或者: from clld.db.models.common.Language import history [as 別名]
    def test_Base(self):
        l = Language(id='abc', name='Name')
        VersionedDBSession.add(l)
        VersionedDBSession.flush()
        VersionedDBSession.expunge(l)
        #print('pk: %s' % l.pk)
        #transaction.commit()
        #transaction.begin()
        #l = VersionedDBSession.query(Language).get(1)
        #print(l)
        #l.name = 'New name'
        #print('pk: %s' % l.pk)
        #transaction.commit()
        #transaction.begin()
        l = Language.get('abc')
        #print(l.version)
        self.assertEqual(l.name, 'Name')
        l.history()

        # a bit of a hack to test the human readable representations.
        # we exploit the fact, that on py2, string and unicode comparison does type
        # coercion, while on py3, the two methods should actualy return the same string.
        self.assertEqual(l.__str__(), l.__unicode__())
        Language().__str__()
開發者ID:mitcho,項目名稱:clld,代碼行數:26,代碼來源:test_db_meta.py


注:本文中的clld.db.models.common.Language.history方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。