-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_p0205_isomorphic_strings.py
49 lines (40 loc) · 1.13 KB
/
test_p0205_isomorphic_strings.py
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
45
46
47
48
49
# flake8: noqa: F403, F405
import pytest
from leetcode.p0205_isomorphic_strings import *
solutions = [
isIsomorphic,
]
test_cases = [
(["egg", "add"], True),
(["foo", "bar"], False),
(["paper", "title"], True),
]
@pytest.mark.timeout(1)
@pytest.mark.parametrize(("args", "expectation"), test_cases)
@pytest.mark.parametrize("solution", solutions)
def test_solution(args, expectation, solution):
assert solution(*args) == expectation
follow_up_solutions = [
group_isomorphic,
]
follow_up_test_cases = [
(
["aab", "xxy", "xyz", "abc", "def", "xyx"],
[["aab", "xxy"], ["xyz", "abc", "def"], ["xyx"]],
),
(
["bc", "dd", "cc", "cb", "aa", "ax", "foo", "bar", "kff", "ddd"],
[
["bc", "cb", "ax"],
["dd", "cc", "aa"],
["foo", "kff"],
["bar"],
["ddd"],
],
),
]
@pytest.mark.timeout(1)
@pytest.mark.parametrize(("args", "expectation"), follow_up_test_cases)
@pytest.mark.parametrize("solution", follow_up_solutions)
def test_follow_up_solution(args, expectation, solution):
assert solution(args) == expectation