本文整理汇总了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)
示例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)
示例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)
示例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')
示例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'Ø')
示例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)