当前位置: 首页>>代码示例>>Python>>正文


Python Request.cleanUpSQL方法代码示例

本文整理汇总了Python中DIRAC.RequestManagementSystem.Client.Request.Request.cleanUpSQL方法的典型用法代码示例。如果您正苦于以下问题:Python Request.cleanUpSQL方法的具体用法?Python Request.cleanUpSQL怎么用?Python Request.cleanUpSQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DIRAC.RequestManagementSystem.Client.Request.Request的用法示例。


在下文中一共展示了Request.cleanUpSQL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test07List

# 需要导入模块: from DIRAC.RequestManagementSystem.Client.Request import Request [as 别名]
# 或者: from DIRAC.RequestManagementSystem.Client.Request.Request import cleanUpSQL [as 别名]
  def test07List( self ):
    """ setitem, delitem, getitem and dirty """

    r = Request()

    ops = [ Operation() for i in range( 5 ) ]

    for op in ops:
      r.addOperation( op )

    for i, op in enumerate( ops ):
      self.assertEqual( op, r[i], "__getitem__ failed" )

    op = Operation()
    r[0] = op
    self.assertEqual( op, r[0], "__setitem__ failed" )

    del r[0]
    self.assertEqual( len( r ), 4, "__delitem__ failed" )

    r.RequestID = 1
    del r[0]
    self.assertEqual( r.cleanUpSQL(), None, "cleanUpSQL failed after __delitem__ (no opId)" )

    r[0].OperationID = 1
    del r[0]
    clean = r.cleanUpSQL()
    self.assertEqual( clean,
                      ['DELETE FROM `Operation` WHERE `RequestID`=1 AND `OperationID` IN (1);\n',
                       'DELETE FROM `File` WHERE `OperationID`=1;\n'],
                      "cleanUpSQL failed after __delitem__ (opId set)\n%s" % clean )

    r[0].OperationID = 2
    r[0] = Operation()
    clean = r.cleanUpSQL()
    self.assertEqual( clean,
                      ['DELETE FROM `Operation` WHERE `RequestID`=1 AND `OperationID` IN (1,2);\n',
                      'DELETE FROM `File` WHERE `OperationID`=1;\n', 'DELETE FROM `File` WHERE `OperationID`=2;\n'],
                      "cleanUpSQL failed after __setitem_ (opId set):\n%s" % clean )

    json = r.toJSON()
    self.assertEqual( "__dirty" in json["Value"], True, "__dirty missing in json" )

    r2 = Request( json["Value"] )
    self.assertEqual( r.cleanUpSQL(), r2.cleanUpSQL(), "wrong cleanUpSQL after json" )
开发者ID:Teddy22,项目名称:DIRAC,代码行数:47,代码来源:RequestTests.py


注:本文中的DIRAC.RequestManagementSystem.Client.Request.Request.cleanUpSQL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。