def test_make_quote():
    data_rect = load_file('./examples/Rectangle.json')
    data_extrude_circular_arc = load_file('./examples/ExtrudeCircularArc.json')
    data_circular_arc = load_file('./examples/CircularArc.json')
    assert '{0:.2f}'.format(helpers.make_quote(data_rect)) == '14.10'
    assert '{0:.2f}'.format(helpers.make_quote(data_extrude_circular_arc)) == '4.47'
    assert '{0:.2f}'.format(helpers.make_quote(data_circular_arc)) == '4.06'

    data_rect = load_file('./examples/Rectangle.json', optimize=True)
    data_extrude_circular_arc = load_file('./examples/ExtrudeCircularArc.json', optimize=True)
    data_circular_arc = load_file('./examples/CircularArc.json', optimize=True)
    assert '{0:.2f}'.format(helpers.make_quote(data_rect)) == '14.10'
    assert '{0:.2f}'.format(helpers.make_quote(data_extrude_circular_arc)) == '4.47'
    assert '{0:.2f}'.format(helpers.make_quote(data_circular_arc)) == '4.06'

    data_missing_corners = load_file('./examples/MissingCorners.json')
    assert '{0:.2f}'.format(helpers.make_quote(data_missing_corners)) == '15.41'
Example #2
0
def quote(filepath=('f', '', 'Path to profile representation file'),
          optimize_rectangle=('', False, 'Optimize for the smallest rectangular\
            piece of stock which can contain the profile')):
    data = load_file(filepath, optimize=optimize_rectangle)
    print '{0:.2f} dollars'.format(make_quote(data))