Example #1
0
    def test___init__1(self):
        """
        Tests a variety of generic cases.

        Test tag: <tc>#tests#Line.__init__</tc>
        """
        for m, b in [(4, 0.0), (-140, 5), (0, 0)]:
            l = Line(m, b)
Example #2
0
    def test_x1(self):
        """
        Tests a variety of generic and special cases (+-infinity).

        Test tag: <tc>#tests#Line.x</tc>
        """
        l = Line(0, 0)
        #self.assertEquals(l.x(0), 0)
        with self.assertRaises(ArithmeticError):
            l.x(0)
        with self.assertRaises(ArithmeticError):
            l.x(-1e600)
        with self.assertRaises(ArithmeticError):
            l.x(1e600)

        l = Line(1, 1)
        self.assertEquals(l.x(3), 2)
        self.assertEquals(l.x(-1e600), -1e600)
        self.assertEquals(l.x(1e600), 1e600)

        l = Line(-1, 1)
        self.assertEquals(l.x(2), -1)
        self.assertEquals(l.x(-1e600), 1e600)
        self.assertEquals(l.x(1e600), -1e600)
Example #3
0
    def test_y1(self):
        """
        Tests a variety of generic and special cases (+-infinity).

        Test tag: <tc>#tests#Line.y</tc>
        """
        l = Line(0, 0)
        self.assertEquals(l.y(0), 0)
        self.assertEquals(l.y(-1e600), 0)
        self.assertEquals(l.y(1e600), 0)

        l = Line(1, 1)
        self.assertEquals(l.y(2), 3)
        self.assertEquals(l.y(-1e600), -1e600)
        self.assertEquals(l.y(1e600), 1e600)

        l = Line(-1, 1)
        self.assertEquals(l.y(2), -1)
        self.assertEquals(l.y(-1e600), 1e600)
        self.assertEquals(l.y(1e600), -1e600)
    def test_x1(self):
        """
        Tests a variety of generic and special cases (+-infinity).

        Test tag: <tc>#tests#Line.x</tc>
        """
        l = Line(0, 0)
        #self.assertEquals(l.x(0), 0)
        with self.assertRaises(ArithmeticError):
            l.x(0)
        with self.assertRaises(ArithmeticError):
            l.x(-1e600)
        with self.assertRaises(ArithmeticError):
            l.x(1e600)

        l = Line(1, 1)
        self.assertEquals(l.x(3), 2)
        self.assertEquals(l.x(-1e600), -1e600)
        self.assertEquals(l.x(1e600), 1e600)

        l = Line(-1, 1)
        self.assertEquals(l.x(2), -1)
        self.assertEquals(l.x(-1e600), 1e600)
        self.assertEquals(l.x(1e600), -1e600)
    def test_y1(self):
        """
        Tests a variety of generic and special cases (+-infinity).

        Test tag: <tc>#tests#Line.y</tc>
        """
        l = Line(0, 0)
        self.assertEquals(l.y(0), 0)
        self.assertEquals(l.y(-1e600), 0)
        self.assertEquals(l.y(1e600), 0)

        l = Line(1, 1)
        self.assertEquals(l.y(2), 3)
        self.assertEquals(l.y(-1e600), -1e600)
        self.assertEquals(l.y(1e600), 1e600)

        l = Line(-1, 1)
        self.assertEquals(l.y(2), -1)
        self.assertEquals(l.y(-1e600), 1e600)
        self.assertEquals(l.y(1e600), -1e600)