def test_a_stripe_pattern_is_constant_in_z(self): black = Color(0, 0, 0) white = Color(1, 1, 1) p = StripePattern(white, black) self.assertTrue(white.equals(p.pattern_at(Point(0, 0, 0)))) self.assertTrue(white.equals(p.pattern_at(Point(0, 0, 1)))) self.assertTrue(white.equals(p.pattern_at(Point(0, 0, 2))))
def test_a_stripe_pattern_alternates_in_x(self): black = Color(0, 0, 0) white = Color(1, 1, 1) p = StripePattern(white, black) self.assertTrue(white.equals(p.pattern_at(Point(0, 0, 0)))) self.assertTrue(white.equals(p.pattern_at(Point(0.9, 0, 0)))) self.assertTrue(black.equals(p.pattern_at(Point(1, 0, 0)))) self.assertTrue(black.equals(p.pattern_at(Point(-0.1, 0, 0)))) self.assertTrue(black.equals(p.pattern_at(Point(-1, 0, 0)))) self.assertTrue(white.equals(p.pattern_at(Point(-1.1, 0, 0))))