Created
July 30, 2014 19:58
-
-
Save jmchilton/a7c4020ddf6520ca3601 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from galaxy.util import topsort | |
def test_topsort_level_stability(): | |
data = [ | |
(0, 2), | |
(1, 2), | |
(2, 3), | |
(2, 4), | |
(3, 4), | |
(3, 5), | |
] | |
assert topsort.topsort( data ) == [ 0, 1, 2, 3, 4, 5 ] | |
# Swap first two edges - so 1 appears first | |
tmp = data[ 0 ] | |
data[ 0 ] = data[ 1 ] | |
data[ 1 ] = tmp | |
assert topsort.topsort( data ) == [ 1, 0, 2, 3, 4, 5 ] | |
# Above line fails... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment