Esempio n. 1
0
def parse_logger_id(line):
    # non IGC loggers may use more than 3 characters as unique ID.
    # we just use the first three, currently no model is known which
    # really uses more than 3 characters.

    if line[1:4] == 'FIL':
        # filser doesn't respect the IGC file specification and
        # stores the unique id as base 10 instead of base 36.
        match = afil_re.match(line)
        if match and match.group(1):
            return base36encode(int(match.group(1)))
    else:
        return import_alnum(line[4:7]).upper()
Esempio n. 2
0
def test_import_alnum():
    assert import_alnum('abc def'), u'abcdef'
    assert import_alnum('abc +-. def'), u'abcdef'

    with pytest.raises(AssertionError):
        import_alnum(u'abc def')
    with pytest.raises(AssertionError):
        import_alnum(None)
Esempio n. 3
0
def test_import_alnum():
    assert import_alnum(b"abc def"), u"abcdef"
    assert import_alnum(b"abc +-. def"), u"abcdef"

    with pytest.raises(AssertionError):
        import_alnum(u"abc def")
    with pytest.raises(AssertionError):
        import_alnum(None)
Esempio n. 4
0
def test_import_alnum():
    assert import_alnum('abc def'), u'abcdef'
    assert import_alnum('abc +-. def'), u'abcdef'

    with pytest.raises(AssertionError): import_alnum(u'abc def')
    with pytest.raises(AssertionError): import_alnum(None)
Esempio n. 5
0
def test_import_alnum():
    eq_(import_alnum('abc def'), u'abcdef')
    eq_(import_alnum('abc +-. def'), u'abcdef')

    assert_raises(AssertionError, import_alnum, u'abc def')
    assert_raises(AssertionError, import_alnum, None)