Example #1
0
def test_validate_bad_opt():
    """
    validate_opts.py: Test validate() with missing attributes in opts
    """
    a = OptObj(input='.', output='anchorhub-out', wrapper='{ }',
               overwrite=False)
    assert v._validate(a)
Example #2
0
def test_validate_bad_extensions():
    """
    validate_opts.py: Test validate() with bad extension list
    """
    a = OptObj(input='.', output='anchorhub-out', wrapper='{ }',
               extensions=['.md', '', '.rst'], overwrite=False)
    assert v._validate(a)
Example #3
0
def test_validate_bad_overwrite():
    """
    validate_opts.py: Test validate() with same input/output, overwrite=False
    """
    a = OptObj(input='.', output='.', wrapper='{ }', extensions=['.md'],
               overwrite=False)
    assert v._validate(a)
Example #4
0
def test_validate_bad_wrapper():
    """
    validate_opts.py: Test validate() with bad wrapper format
    """
    a = OptObj(input='.', output='anchorhub-out', wrapper='{ } { }',
               extensions=['.md'], overwrite=False)
    assert v._validate(a)
Example #5
0
def test_validate_good():
    """
    validate_opts.py: Test validate() with good inputs
    """

    a = OptObj(input='.', output='anchorhub-out', wrapper='{ }',
               extensions=['.md'], overwrite=False)
    assert v._validate(a)

    b = OptObj(input='.', output='.', wrapper='{ }',
               extensions=['.md'], overwrite=True)
    assert v._validate(b)

    c = OptObj(input='.', output='anchorhub-out', wrapper='[--> ????',
               extensions=['.md'], overwrite=False)
    assert v._validate(c)

    d = OptObj(input='.', output='anchorhub-out', wrapper='{ }',
               extensions=['.md', '.rst', '.hub'], overwrite=False)
    assert v._validate(d)