File: test_adffile.py

package info (click to toggle)
fs-uae-arcade 3.1.63-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 24,456 kB
  • sloc: python: 56,011; makefile: 170
file content (44 lines) | stat: -rw-r--r-- 1,011 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import fstd.adffile
import os
import hashlib
import fstd.mypy
from nose.tools import *


def get_transplant_adf() -> fstd.adffile.ADFFile:
    adf = fstd.adffile.ADFFile(
        os.path.join(os.path.dirname(__file__), "adffile", "transplant.adf")
    )
    return adf


def test_namelist():
    adf = get_transplant_adf()
    expected_names = [
        "devs/",
        "devs/system-configuration",
        "l/",
        "l/disk-validator",
        "loader",
        "mainpart",
        "s/",
        "s/startup-sequence",
    ]
    assert_equal(sorted(adf.namelist()), expected_names)


def test_read_startup_sequence():
    adf = get_transplant_adf()
    data = adf.read("s/startup-sequence")
    assert_equal(data, b"loader\n")


def test_read_mainpart():
    adf = get_transplant_adf()
    data = adf.read("mainpart")
    data_sha1 = hashlib.sha1(data).hexdigest()
    assert_equal(data_sha1, "ef467af52c8a886a6bca6ceb7f263fb8cbee2d59")


def test_mypy():
    fstd.mypy.check_module(fstd.adffile.__name__)