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


Python NailgunProtocol.construct_chunk方法代码示例

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


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

示例1: test_read_chunk_truncated_during_payload

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import construct_chunk [as 别名]
  def test_read_chunk_truncated_during_payload(self):
    """Construct a chunk and truncate the last 3 bytes of the payload ([:-3])."""
    truncated_chunk = NailgunProtocol.construct_chunk(ChunkType.STDOUT, self.TEST_OUTPUT)[:-3]
    self.server_sock.sendall(truncated_chunk)
    self.server_sock.close()

    with self.assertRaises(NailgunProtocol.TruncatedPayloadError):
      NailgunProtocol.read_chunk(self.client_sock)
开发者ID:Gointer,项目名称:pants,代码行数:10,代码来源:test_nailgun_protocol.py

示例2: test_read_chunk_truncated_before_payload

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import construct_chunk [as 别名]
  def test_read_chunk_truncated_before_payload(self):
    """Construct a chunk and send exactly the header (first 5 bytes) and truncate the remainder."""
    truncated_chunk = NailgunProtocol.construct_chunk(ChunkType.STDOUT, self.TEST_OUTPUT)[:5]
    self.server_sock.sendall(truncated_chunk)
    self.server_sock.close()

    with self.assertRaises(NailgunProtocol.TruncatedPayloadError):
      NailgunProtocol.read_chunk(self.client_sock)
开发者ID:Gointer,项目名称:pants,代码行数:10,代码来源:test_nailgun_protocol.py

示例3: test_read_chunk_truncated_during_header

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import construct_chunk [as 别名]
  def test_read_chunk_truncated_during_header(self):
    """Construct a chunk and truncate to the first 3 bytes ([:3]), an incomplete header."""
    truncated_chunk = NailgunProtocol.construct_chunk(ChunkType.STDOUT, self.TEST_OUTPUT)[:3]
    self.server_sock.sendall(truncated_chunk)
    self.server_sock.close()

    with self.assertRaises(NailgunProtocol.TruncatedHeaderError):
      NailgunProtocol.read_chunk(self.client_sock)
开发者ID:Gointer,项目名称:pants,代码行数:10,代码来源:test_nailgun_protocol.py

示例4: test_construct_chunk_bytes

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import construct_chunk [as 别名]
 def test_construct_chunk_bytes(self):
   NailgunProtocol.construct_chunk(ChunkType.STDOUT, b'yes')
开发者ID:Gointer,项目名称:pants,代码行数:4,代码来源:test_nailgun_protocol.py

示例5: test_construct_chunk_unicode

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import construct_chunk [as 别名]
 def test_construct_chunk_unicode(self):
   NailgunProtocol.construct_chunk(ChunkType.STDOUT, u'Ø')
开发者ID:Gointer,项目名称:pants,代码行数:4,代码来源:test_nailgun_protocol.py

示例6: test_construct_chunk

# 需要导入模块: from pants.java.nailgun_protocol import NailgunProtocol [as 别名]
# 或者: from pants.java.nailgun_protocol.NailgunProtocol import construct_chunk [as 别名]
 def test_construct_chunk(self):
   with self.assertRaises(TypeError):
     NailgunProtocol.construct_chunk(ChunkType.STDOUT, 1111)
开发者ID:Gointer,项目名称:pants,代码行数:5,代码来源:test_nailgun_protocol.py


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