File: python3-smoketest

package info (click to toggle)
toposort 1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 112 kB
  • ctags: 26
  • sloc: python: 193; sh: 40; makefile: 10
file content (27 lines) | stat: -rw-r--r-- 565 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
#!/bin/sh

cd "$ADTTMP"
cat > test.py << EOF
#!/usr/bin/python3


from toposort import toposort, toposort_flatten

data = {2: {11},
        9: {11, 8, 10},
        10: {11, 3},
        11: {7, 5},
        8: {7, 3}}
simple = [{3, 5, 7}, {8, 11}, {2, 10}, {9}]
flatten = [3, 5, 7, 8, 11, 2, 10, 9]

try:
    assert(list(toposort(data)) == simple)
except AssertionError:
    raise AssertionError('toposort failed')
try:
    assert(list(toposort_flatten(data)) == flatten)
except AssertionError:
    raise AssertionError('toposort_flatten failed')
EOF
python3 test.py