-
Notifications
You must be signed in to change notification settings - Fork 0
/
exp_test.py
32 lines (28 loc) · 967 Bytes
/
exp_test.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
import exp
def test_replace():
cases = [
{
"start": {"robot": "$robot"},
"vars": {"$robot": "active" },
"end": {"robot": "active" },
},
{
"start": {"robot": u'$robot'},
"vars": {"$robot": u'active' },
"end": {"robot": "active" },
},
{
"start": {"likelihood_params": { "temperature": "$temperature" } },
"vars": {"$temperature": 10.0 },
"end": {"likelihood_params": { "temperature": 10.0 } },
}
]
for (i, case) in enumerate(cases):
try:
exp.replace(case["start"], case["vars"])
if not case["start"] == case["end"]:
raise Exception("got " + repr(case["start"]) + " want: " + repr(case["end"]))
except Exception as e:
print("exp_test.test_replace: case: " + repr(i) + ": " + repr(e))
if __name__ == "__main__":
test_replace()