Пример #1
0
    def test_point_negative_on_one_line(self):
        """Negative test of Point.on_one_line method."""
        a = Point(1, 0)
        b = Point(34, 0)
        c = Point(42, 0)

        with self.assertRaises(ValueError) as err:
            Point.on_one_line('foo', a, b, c)
            self.assertEqual(
                err.args[0], "Some of given arguments is not points.",
                "Test of Point.on_one_line('foo', a, b, c) failed, no ValueError was raised."
            )
Пример #2
0
    def test_point_positive_on_one_line(self):
        """Negative test of Point.on_one_line method."""
        a = Point(1, 0)
        b = Point(34, 0)
        c = Point(42, 0)

        self.assertTrue(
            Point.on_one_line(a, b, c),
            "Test of Point.on_one_line(a, b, c) failed, returned value != True."
        )
        d = Point(1, 2)
        e = Point(34, 43)
        f = Point(42, 54)

        self.assertFalse(
            Point.on_one_line(d, e, f),
            "Test of Point.on_one_line(d, e, f) failed, returned value != False."
        )

        self.assertTrue(
            Point.on_one_line(a),
            "Test of Point.on_one_line(a) failed, returned value != True.")