def testFractionalJConversion(self): a = Transition(500 * u.nm, 26, 1) a.lowerJ = 1.5 assert a.lowerJ == Fraction(3, 2) a.lowerJ = None assert a.lowerJ is None a.higherJ = 2 assert a.higherJ == Fraction(2, 1) a.higherJ = None assert a.higherJ is None
def mock_transition(self): a = Transition(558.0345 * u.nm, 54, 1) a.lowerEnergy = 17.012 * u.cm**-1 a.lowerOrbital = '(4F)4s a5F' a.lowerJ = 1.5 a.higherEnergy = 12051.823 * u.cm**-1 a.higherOrbital = '3Gsp3P x3H' a.higherJ = 0 a.normalizedDepth = 0.234 return a
def testEquality(self): a = Transition(500.0 * u.nm, 26, 1) b = Transition(500.0 * u.nm, 26, 1) with pytest.raises(ValueError): assert a == 'A non-transition' assert a == b a.lowerEnergy = b.lowerEnergy = 1.3 * u.eV assert a == b a.higherEnergy = b.higherEnergy = 5.6 * u.eV assert a == b a.lowerJ = b.lowerJ = 1.5 assert a == b a.higherJ = b.higherJ = 0.5 assert a == b a.lowerOrbital = b.lowerOrbital = '3d8.(3F).4s.4p.(3P*)' assert a == b a.higherOrbital = b.higherOrbital = '3d8.4s.(2F).5s ' assert a == b # Now test for inequality. b.higherOrbital = 'non-existent' assert a != b b.lowerOrbital = "it's gone too" assert a != b b.higherJ = 3 assert a != b b.lowerJ = 0 assert a != b b.higherEnergy = 4 * u.eV assert a != b b.lowerEnergy = 3 * u.eV assert a != b b.ionizationState = 2 assert a != b b.ionizationState = 1 b.atomicNumber = 27 assert a != b b.atomicNumber = 26 b.wavelength = 501 * u.nm assert a != b