本文整理匯總了Python中DIRAC.DataManagementSystem.Client.FTSJob.FTSJob.toJSON方法的典型用法代碼示例。如果您正苦於以下問題:Python FTSJob.toJSON方法的具體用法?Python FTSJob.toJSON怎麽用?Python FTSJob.toJSON使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DIRAC.DataManagementSystem.Client.FTSJob.FTSJob
的用法示例。
在下文中一共展示了FTSJob.toJSON方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test01Ctor
# 需要導入模塊: from DIRAC.DataManagementSystem.Client.FTSJob import FTSJob [as 別名]
# 或者: from DIRAC.DataManagementSystem.Client.FTSJob.FTSJob import toJSON [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" )