コード例 #1
0
    def test_linear_coefficient(self):
        p1 = p.Point(2, 2.5)
        p2 = p.Point(4, 4)
        line = l.Line()
        line.create(p1, p2)

        assert (float(line.Linear) == (1.0))
コード例 #2
0
    def test_b_coefficient(self):
        p1 = p.Point(2, 2.5)
        p2 = p.Point(4, 4)
        line = l.Line()
        line.create(p1, p2)

        assert (float(line.B) == 2.0)
コード例 #3
0
    def test_angular_coefficient(self):
        p1 = p.Point(2, 2.5)
        p2 = p.Point(4, 4)
        line = l.Line()
        line.create(p1, p2)

        assert (float(line.Angular) == (0.75))
コード例 #4
0
    def test_ACoefficient(self):
        p1 = p.Point(2, 2.5)
        p2 = p.Point(4, 4)
        line = l.Line()
        line.create(p1, p2)

        assert (float(line.A) == (-1.5))
コード例 #5
0
    def test_line_equation(self):
        p1 = p.Point(2, 2)
        p2 = p.Point(4, 4)
        line = l.Line()
        line.create(p1, p2)

        assert (type(line.equation()) == str)
コード例 #6
0
    def test_instance_two_points(self):
        p1 = p.Point(2, 2)
        p2 = p.Point(4, 4)
        line = l.Line()
        line.create(p1, p2)

        assert (str(line) == "-2.0x+2.0y+0=0")
コード例 #7
0
    def test_instance_one_point_and_slope(self):
        p1 = p.Point(4, 4.5)
        line = l.Line()
        line.create_via_slope(p1, 1)

        assert (line.equation() == "y=1x+0.5")
コード例 #8
0
 def test_instance_equation(self):
     line = l.Line()
     line.create_via_equation("-8x+6y-8=0")
     assert (line.equation() == "-8x+6y-8=0")