color_test.py 文件源码

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

项目:Projects 作者: it2school 项目源码 文件源码
def colorspaces_converted_should_equate_bar_rounding (self, prop):
        for c in rgba_combos_Color_generator():
            other = pygame.Color(0)

            try:
                setattr(other, prop, getattr(c, prop))
                #eg other.hsla = c.hsla

                self.assert_(abs(other.r - c.r) <= 1)
                self.assert_(abs(other.b - c.b) <= 1)
                self.assert_(abs(other.g - c.g) <= 1)
                # CMY and I1I2I3 do not care about the alpha
                if not prop in ("cmy", "i1i2i3"):
                    self.assert_(abs(other.a - c.a) <= 1)

            except ValueError:
                pass        # other tests will notify, this tests equation
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号