Skip to content

Commit 7946471

Browse files
committed
updated constants tests to do exact check for c and approx check for h
1 parent b3b48c0 commit 7946471

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎astropy/constants/tests/test_constant.py‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
from .. import Constant,si,cgs
55

66
def test_c():
7-
#no one is going to be updating c to be *too* much off from 3e8...
8-
assert abs(si.c - 3e8)<1e7
9-
assert abs(cgs.c - 3e10)<1e9
7+
#c is an exactly defined constant, so it shouldn't be changing
8+
assert si.c == 2.99792458e8
9+
assert cgs.c == 2.99792458e10
10+
11+
#check that the float-translation stuff works as expected
12+
assert si.c.real == si.c*1
13+
assert cgs.c.real == cgs.c-0
1014

1115
#make sure it has the necessary attributes and they're not blank
1216
assert si.c.error==0 #c is a *defined* quantity
@@ -19,9 +23,10 @@ def test_c():
1923
assert cgs.c.units
2024

2125
def test_h():
22-
#check that the float-translation stuff works as expected
23-
assert si.h.real == si.h*1
24-
assert cgs.h.real == cgs.h-0
26+
#check that the value is fairly close to what it should be (not exactly
27+
#checking because this might get updated in the future)
28+
assert abs(si.h-6.626e-34) < 1e-38
29+
assert abs(cgs.h-6.626e-27) < 1e-31
2530

2631
#make sure it has the necessary attributes and they're not blank
2732
assert si.h.error

0 commit comments

Comments
 (0)