コード例 #1
0
def testCommaSeperatedDataForTags():

    data = ParserUtils.convertLineToParameters("# tags=a, b, c")
    assert (data == {'tags': 'a, b, c'})

    # Whitespace test
    data = ParserUtils.convertLineToParameters("# tags=a something, b, c")
    assert (data == {'tags': 'a something, b, c'})

    data = ParserUtils.convertLineToParameters("# tag=a, tag=b, tag=c")
    assert (data == {'tag': 'a,b,c'})
コード例 #2
0
def test_getImageFromUrl_CommandLineMode():

    googleDocsImageUrl = "https://lh3.googleusercontent.com/gdEMfGtrSRTvbTiXwysYJ_5XxqieWt0Z9vtFw0jQxOlbjo43_PJYa4kCusZjmkbe_euwGa4KAWEo2xJvEzHkwIpVN3H-XvCxVXCpQNOcH9_tERcVodYf75t18hYlargfKgYtHYvM"

    imageData = ParserUtils.getImageFromUrl(googleDocsImageUrl)

    # Poor way to assert an image
    assert (len(imageData) == 92858)
コード例 #3
0
def testParseInvalidLine():

    # Malformatted line
    line = '222222;font-style:italic;"> [broad, fast, wobbly ventricles] </span><span style="color:'

    params = ParserUtils.convertLineToParameters(line)
    print(params)

    assert (True)
コード例 #4
0
def testConvertCommentsToParameters():

    comments = [
        "#fileType=basic, secondArg=10", "##file=basic", "#fileType2 = topics"
    ]
    result = ParserUtils.convertCommentsToParameters(comments)
    expected = {
        'fileType': 'basic',
        'secondArg': '10',
        'file': 'basic',
        'fileType2': 'topics'
    }
    assert (result == expected)
コード例 #5
0
def testConvertLineToParameter():

    assert(ParserUtils.convertLineToParameters("type=Basic") == {'type' : 'Basic'})
    assert(ParserUtils.convertLineToParameters("#type=Basic, type2=2") == {'type' : 'Basic', 'type2':'2'})
    assert(ParserUtils.convertLineToParameters("type = Basic") == {'type' : 'Basic'})
    assert(ParserUtils.convertLineToParameters("#type = Basic") == {'type' : 'Basic'})
    assert(ParserUtils.convertLineToParameters("# type = Basic") == {'type' : 'Basic'})
    assert(ParserUtils.convertLineToParameters("# type = Basic (and reversed card), sec=1") == {'type' : 'Basic (and reversed card)', 'sec':'1'})
コード例 #6
0
def testEmptyLine():

    line = "# Only a commnet! No data"
    data = ParserUtils.convertLineToParameters(line)

    assert (data == {})
コード例 #7
0
def testMultipleParameters():

    line = "#type0=a, type1=b, type2=c"
    data = ParserUtils.convertLineToParameters(line)

    assert (data == {'type0': 'a', 'type1': 'b', 'type2': 'c'})