コード例 #1
0
    def test_equivalent_spanish_names_work(self):
        # draw some things using the english commands in tortuga
        tortuga.adelante(50)
        tortuga.izquierda(90)
        tortuga.adelante(50)
        tortuga.derecho(45)
        tortuga.atras(50)
        tortuga.izquierda(45)
        tortuga.tamano_lapiz(5)
        for c in (english_colors):
            tortuga.color(c)
            tortuga.adelante(10)
        for c in (spanish_colors):
            tortuga.color(c)
            tortuga.adelante(10)

        # now draw the same things using turtle
        turtle.forward(50)
        turtle.left(90)
        turtle.forward(50)
        turtle.right(45)
        turtle.backward(50)
        turtle.left(45)
        turtle.pensize(5)
        for c in (english_colors):
            turtle.color(c)
            turtle.forward(10)
        for c in (english_colors):
            turtle.color(c)
            turtle.forward(10)

        # and make sure they both resulted in the same output
        self.assert_same()
コード例 #2
0
    def test_same_function_names_work(self):
        # draw some things using the english commands in tortuga
        tortuga.forward(50)
        tortuga.left(90)
        tortuga.forward(50)
        tortuga.right(45)
        tortuga.backward(50)
        tortuga.left(45)
        tortuga.pensize(5)
        for c in (english_colors):
            tortuga.color(c)
            tortuga.forward(10)

        # now draw the same things using turtle
        turtle.forward(50)
        turtle.left(90)
        turtle.forward(50)
        turtle.right(45)
        turtle.backward(50)
        turtle.left(45)
        turtle.pensize(5)
        for c in (english_colors):
            turtle.color(c)
            turtle.forward(10)

        # and make sure they both resulted in the same output
        self.assert_same()
コード例 #3
0
ファイル: turtleTest.py プロジェクト: asweigart/tortuga
    def test_same_function_names_work(self):
        # draw some things using the english commands in tortuga
        tortuga.forward(50)
        tortuga.left(90)
        tortuga.forward(50)
        tortuga.right(45)
        tortuga.backward(50)
        tortuga.left(45)
        tortuga.pensize(5)
        for c in (english_colors):
            tortuga.color(c)
            tortuga.forward(10)

        # now draw the same things using turtle
        turtle.forward(50)
        turtle.left(90)
        turtle.forward(50)
        turtle.right(45)
        turtle.backward(50)
        turtle.left(45)
        turtle.pensize(5)
        for c in (english_colors):
            turtle.color(c)
            turtle.forward(10)

        # and make sure they both resulted in the same output
        self.assert_same()
コード例 #4
0
ファイル: turtleTest.py プロジェクト: asweigart/tortuga
    def test_equivalent_spanish_names_work(self):
        # draw some things using the english commands in tortuga
        tortuga.adelante(50)
        tortuga.izquierda(90)
        tortuga.adelante(50)
        tortuga.derecho(45)
        tortuga.atras(50)
        tortuga.izquierda(45)
        tortuga.tamano_lapiz(5)
        for c in (english_colors):
            tortuga.color(c)
            tortuga.adelante(10)
        for c in (spanish_colors):
            tortuga.color(c)
            tortuga.adelante(10)

        # now draw the same things using turtle
        turtle.forward(50)
        turtle.left(90)
        turtle.forward(50)
        turtle.right(45)
        turtle.backward(50)
        turtle.left(45)
        turtle.pensize(5)
        for c in (english_colors):
            turtle.color(c)
            turtle.forward(10)
        for c in (english_colors):
            turtle.color(c)
            turtle.forward(10)

        # and make sure they both resulted in the same output
        self.assert_same()
コード例 #5
0
    def test_color(self):
        for c in (spanish_colors):
            tortuga.color(c)
            tortuga.forward(3)

        for c in (english_colors):
            turtle.color(c)
            turtle.forward(3)

        self.assert_same()
コード例 #6
0
ファイル: turtleTest.py プロジェクト: asweigart/tortuga
    def test_color(self):
        for c in (spanish_colors):
            tortuga.color(c)
            tortuga.forward(3)

        for c in (english_colors):
            turtle.color(c)
            turtle.forward(3)

        self.assert_same()
コード例 #7
0
ファイル: guiTest.py プロジェクト: cccczl/tortuga
import sys
import os

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import tortuga

tortuga.forward(50)
tortuga.left(90)
tortuga.forward(50)
tortuga.right(45)
tortuga.backward(50)
tortuga.left(45)
tortuga.pensize(5)
for c in ('blue brown orange gray green purple pink yellow white black red'.split()):
    tortuga.color(c)
    tortuga.forward(10)

t = tortuga.Tortuga()
t.subir_lapiz()
t.ir_a(-100, 0)
t.bajar_lapiz()
t.adelante(50)
t.izquierda(90)
t.adelante(50)
t.derecho(45)
t.atras(50)
t.izquierda(45)
t.tamano_lapiz(5)
for c in ('azul marron naranja gris verde morado rosa amarillo blanco negro rojo'.split()):
    t.color(c)