예제 #1
0
def test_detect_encoding2():
    lines = []
    output = MemFile(b'1\n2\n')
    assert process_encoding(lines, output) == None
    assert lines == [b'1\n']
    assert process_encoding(lines, output) == None
    assert lines == [b'1\n', b'2\n']
예제 #2
0
def test_detect_encoding1():
    lines = []
    output = MemFile(b'#first comment\n#  -- coding: abcd --')
    assert process_encoding(lines, output) == None
    assert lines == [b'#first comment\n']
    assert process_encoding(lines, output) == 'abcd'
    assert lines == [b'#first comment\n']
예제 #3
0
def test_detect_encoding2():
    with open('test/samples/print1250r.py', 'rb') as f:
        lines = []
        process_encoding(lines, f) == 'cp1250'
        assert lines == []