示例#1
0
def test_max_width():
    """Test max width and field alignment"""
    record = MasterRecord()
    record.update(test_data)
    # Fake config and change default param MAX_LINE_WIDTH
    record.mst = Lyer()
    record.mst.config.INPUT_ENCODING = 'utf-8'
    record.mst.config.OUTPUT_ENCODING = 'utf-8'
    record.mst.config.MAX_LINE_WIDTH = 40
    record.mst.config.YACC_DEBUG = False
    expr_list = (
        ("v44",
         'Methodology of plant eco-physiology: \nproceedings of the Montpellier \nSymposium'
         ),
        ("v44(0,0)",
         'Methodology of plant eco-physiology: \nproceedings of the Montpellier \nSymposium'
         ),
        ("v44(10)",
         '          Methodology of plant \neco-physiology: proceedings of the \nMontpellier Symposium'
         ),
        ("v44(0,5)",
         'Methodology of plant eco-physiology: \n     proceedings of the Montpellier \n     Symposium'
         ),
        ("v44(10,5)",
         '          Methodology of plant \n     eco-physiology: proceedings of the \n     Montpellier Symposium'
         ),
        # special case of unbreakable line
        ("'%s'" % ('a' * 120),
         u'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
         ),
    )
    run_list(expr_list, record)
示例#2
0
def test_max_width_off():
    """Test max width==0 and field alignment"""
    record = MasterRecord()
    record.update(test_data)
    # Fake config and change default param MAX_LINE_WIDTH
    record.mst = Lyer()
    record.mst.config.INPUT_ENCODING = 'utf-8'
    record.mst.config.OUTPUT_ENCODING = 'utf-8'
    record.mst.config.MAX_LINE_WIDTH = 0
    record.mst.config.YACC_DEBUG = False
    expr_list = (
        ("v44",
         '\nMethodology of plant eco-physiology: proceedings of the Montpellier Symposium'
         ),
        ("v44(0,0)", ''),
        ("v44(10)", ''),
        ("v44(0,5)", ''),
        ("v44(10,5)", ''),
    )
    run_list(expr_list, record)