コード例 #1
0
def test_unhexlify_not_python():
    """
    Test that the MicroPython script start format is present.
    """
    assert "" == uflash.unhexlify(
        ":020000040003F7\n:10E000000000000000000000000000000000000010"
    )
コード例 #2
0
def test_unhexlify_bad_unicode():
    """
    Test that invalid Unicode is dealt gracefully returning an empty string.
    """
    assert "" == uflash.unhexlify(
        ":020000040003F7\n:10E000004D50FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
    )
コード例 #3
0
def test_unhexlify():
    """
    Ensure that we can get the script back out using unhexlify and that the
    result is a properly decoded string.
    """
    unhexlified = uflash.unhexlify(TEST_SCRIPT_HEXLIFIED)
    assert unhexlified == TEST_SCRIPT.decode("utf-8")
コード例 #4
0
ファイル: test_uflash.py プロジェクト: ntoll/uflash
def test_unhexlify():
    """
    Ensure that we can get the script back out using unhexlify and that the
    result is a properly decoded string.
    """
    hexlified = uflash.hexlify(TEST_SCRIPT)
    unhexlified = uflash.unhexlify(hexlified)
    assert unhexlified == TEST_SCRIPT.decode('utf-8')