matchers.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:nimi-python 作者: ni 项目源码 文件源码
def __eq__(self, other):
        if not isinstance(other, ctypes.Array):
            print("Unexpected type. Expected: {0}. Received: {1}".format(ctypes.Array, type(other)))
            return False
        if len(other) < len(self.expected_string_value) + 1:  # +1 for NULL terminating character
            print("Unexpected length in C string. Expected at least: {0}. Received {1}".format(len(other), len(self.expected_string_value) + 1))
            return False
        if not isinstance(other[0], bytes):
            print("Unexpected type. Not a string. Received: {0}".format(type(other[0])))
            return False
        if other.value.decode("ascii") != self.expected_string_value:
            print("Unexpected value. Expected {0}. Received: {1}".format(self.expected_string_value, other.value.decode))
            return False
        return True


# Custom Type
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号