Beispiel #1
0
def test_penplot_05():
    """xy assignment must have lenth == 2*n"""
    p = _PenPlot([(0, 0)])
    with raises(TypeError):
        p.xy = (1,)
    with raises(TypeError):
        p.xy = (1, 2, 3)
Beispiel #2
0
def test_penplot_06():
    """xy can be set to None"""
    p = _PenPlot([(0, 0)])
    p.xy = None
    assert isinstance(p.xy, CoordinateArray)
    assert len(p.xy) == 0
    assert len(p.x) == 0
    assert len(p.y) == 0
Beispiel #3
0
def test_penplot_06( ):
    '''xy can be set to None'''
    p = _PenPlot([(0,0)])
    p.xy = None
    assert isinstance(p.xy, CoordinateArray)
    assert len(p.xy) == 0
    assert len(p.x) == 0
    assert len(p.y) == 0
Beispiel #4
0
def test_penplot_04():
    """xy can be set with a list or tuple."""
    p = _PenPlot([(0, 0)])
    p.xy = [(1, 2)]
    assert p.xy == CoordinateArray([(1, 2)])
    p.xy = [(1, 2), (3, 4)]
    assert p.xy == CoordinateArray([(1, 2), (3, 4)])
    assert p.x == (1, 3)
    assert p.y == (2, 4)
Beispiel #5
0
def test_penplot_04( ):
    '''xy can be set with a list or tuple.'''
    p = _PenPlot([(0,0)])
    p.xy = [(1,2)]
    assert p.xy == CoordinateArray([(1,2)])
    p.xy = [(1,2),(3,4)]
    assert p.xy == CoordinateArray([(1,2),(3,4)])
    assert p.x == (1, 3)
    assert p.y == (2, 4)
Beispiel #6
0
def test_penplot_03():
    """xy cannot be set with an single number."""
    p = _PenPlot([(1, 2)])
    with raises(TypeError):
        p.xy = 3
Beispiel #7
0
def test_penplot_01():
    """_PenPlot cannot be initialized with a flat iterable"""
    with pytest.raises(TypeError):
        _PenPlot((1, 2, 3, 4))
Beispiel #8
0
def test_penplot_03( ):
    '''xy cannot be set with an single number.'''
    p = _PenPlot([(1,2)])
    assert raises(TypeError, 'p.xy = 3')
Beispiel #9
0
def test_penplot_05( ):
    '''xy assignment must have lenth == 2*n'''
    p = _PenPlot([(0,0)])
    assert raises(TypeError, 'p.xy =(1,)')
    assert raises(TypeError, 'p.xy =(1,2,3)')