-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
50 lines (37 loc) · 1.23 KB
/
tests.py
File metadata and controls
50 lines (37 loc) · 1.23 KB
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
50
""" Tests for things """
import sympy as sy
from sympy import *
from feynman import Amplitude
from term import Momentum
def test(result, name):
if result:
print("{0} passed".format(name))
else:
print("{0} failed".format(name))
def run_flip_variants_test():
p_up = Momentum("p", "SLASHmu", 1)
p_down = Momentum("p", "SLASHmu", 0)
m = sy.Symbol("m")
expr = Amplitude.flip_variant(p_up + m)
test(expr == p_down + m, "run_flip_variants_test_1")
expr = Amplitude.flip_variant(p_down)
test(expr == p_up, "run_flip_variants_test_2")
def run_subtract_momenta_test():
p = Momentum("p", "SLASHmu", 1)
k = Momentum("k", "SLASHmu", 1)
expr = p - k
test(expr != sy.S.Zero, "run_subtract_momenta_test")
def run_highest_log_test():
Lamb = sy.Symbol("Lamb")
expr = 2 * sy.log(Lamb) + 1
#expr = expr.subs(Lamb, sy.exp(Lamb))
#expr = sy.O(expr, (Lamb, sy.oo)).args[0]
import pdb; pdb.set_trace()
expr = sy.O(expr, (Lamb, sy.oo)).args[0]
#expr = expr.subs(Lamb, sy.log(Lamb))
print(expr)
test(expr == 2 * sy.log(Lamb), "run_highest_log_test")
if __name__ == "__main__":
run_flip_variants_test()
run_subtract_momenta_test()
run_highest_log_test()