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


Python FTSJob.toSQL方法代碼示例

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


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

示例1: test01Ctor

# 需要導入模塊: from DIRAC.DataManagementSystem.Client.FTSJob import FTSJob [as 別名]
# 或者: from DIRAC.DataManagementSystem.Client.FTSJob.FTSJob import toSQL [as 別名]
  def test01Ctor( self ):
    """ test ctor and (de-)serilisation """
    ftsJob = FTSJob()
    self.assertEqual( isinstance( ftsJob, FTSJob ), True )

    json = ftsJob.toJSON()
    self.assertEqual( json["OK"], True, "JSON serialization error" )
    self.assertEqual( type( json["Value"] ), dict, "JSON serialization value error" )

    ftsJobJSON = FTSJob( json["Value"] )
    self.assertEqual( isinstance( ftsJobJSON, FTSJob ), True, "JSON de-serialization error" )

    ftsJob.addFile( self.fileA )
    ftsJob.addFile( self.fileB )

    self.assertEqual( len( ftsJob ), 2 )
    self.assertEqual( ftsJob.Files, 2 )
    self.assertEqual( ftsJob.Size, 20 )

    json = ftsJob.toJSON()
    ftsJobJSON = FTSJob( json["Value"] )
    self.assertEqual( isinstance( ftsJobJSON, FTSJob ), True, "JSON de-serilization error" )

    SQL = ftsJob.toSQL()
    self.assertEqual( SQL["OK"], True, "SQL serialization error" )
    self.assertEqual( SQL["Value"].startswith( "INSERT" ), True, "SQL serialization INSERT error" )

    ftsJob.FTSJobID = 123456
    SQL = ftsJob.toSQL()
    self.assertEqual( SQL["OK"], True, "SQL serialization error" )
    self.assertEqual( SQL["Value"].startswith( "UPDATE" ), True, "SQL serialization UPDATE error" )
開發者ID:DIRACGrid-test,項目名稱:DIRAC,代碼行數:33,代碼來源:FIXME_Test_FTSJob.py


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