Skip to content

Commit 908abef

Browse files
malkoGcoolreader18
authored andcommitted
Apply code review for test snippet
1 parent 8a3fb40 commit 908abef

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/snippets/stdlib_random.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@
99
left = list(range(10))
1010
right = [2, 7, 3, 5, 8, 4, 6, 9, 0, 1]
1111
random.shuffle(left)
12-
13-
assert all([l == r for l, r in zip(left, right) ])
12+
assert left == right
1413

1514
# random.choice
1615
assert random.choice(left) == 5
1716

1817
# random.choices
19-
expected = ['red', 'red', 'black', 'red', 'black', 'black']
18+
expected = ['red', 'green', 'red', 'black', 'black', 'red']
2019
result = random.choices(['red', 'black', 'green'], [18, 18, 2], k=6)
21-
assert all([l == r for l, r in zip(expected, result) ])
20+
assert expected == result
2221

2322
# random.sample
24-
sampled = [2, 1, 0]
25-
assert all([l == r for l, r in zip(random.sample(l, 3), sampled) ])
23+
sampled = [0, 2, 1]
24+
assert random.sample(list(range(3)), 3) == sampled
2625

2726
# TODO : random.random(), random.uniform(), random.triangular(),
2827
# random.betavariate, random.expovariate, random.gammavariate,

0 commit comments

Comments
 (0)