Example #1
0
def test_load():
    old_pattern = pattern.load(old_pattern=True)
    assert 'ANSI31' in old_pattern

    p = pattern.load(old_pattern=False)
    assert 'ANSI31' in p

    l1 = p['ANSI31'][0]
    l2 = old_pattern['ANSI31'][0]

    assert l1[2] == (-2.2627, 2.2627)
    assert l2[2] == (-0.0884, 0.0884)
Example #2
0
def test_load_iso_pattern():
    p = pattern.load()
    assert p["ANSI31"][0] == [
        45.0,
        (0.0, 0.0),
        (-2.2450640303, 2.2450640303),
        [],
    ]
Example #3
0
def test_load_imperial_pattern():
    p = pattern.load(measurement=0)
    assert p["ANSI31"][0] == [
        45.0,
        (0.0, 0.0),
        (-0.0883883476, 0.0883883476),
        [],
    ]
Example #4
0
def test_load_scaled_iso_pattern():
    p = pattern.load(factor=2)
    assert p["ANSI31"][0] == [
        45.0,
        (0.0, 0.0),
        (-4.4901280606, 4.4901280606),
        [],
    ]
Example #5
0
def test_scale_pattern():
    p = pattern.load()
    ansi31 = p["ANSI31"]
    s = pattern.scale_pattern(ansi31, 2, angle=90)

    angle, base, offset, lines = s[0]
    assert angle == 135
    assert base == (0, 0)
    assert offset == (-4.4901280606, -4.4901280606)
Example #6
0
def test_scale_pattern():
    p = pattern.load(old_pattern=False)
    ansi31 = p['ANSI31']
    s = pattern.scale_pattern(ansi31, 2, angle=90)

    angle, base, offset, lines = s[0]
    assert angle == 135
    assert base == (0, 0)
    assert offset == (-4.5254, -4.5254)