示例#1
0
 def test_set_redshift2(self):
     # calculate
     expected_result = TestLine.line.redshift
     line = spectro.Line(restwlen=1.282, obswlen=2.564, name='Pa_beta')
     line.set_redshift()
     result = line.redshift
     assert_equal(result, expected_result)
示例#2
0
 def test_set_restwlen2(self):
     # calculate
     expected_result = TestLine.line.restwlen
     line = spectro.Line(obswlen=2.564, redshift=1., name='Pa_beta')
     line.set_restwlen()
     result = line.restwlen
     assert_equal(result, expected_result)
示例#3
0
 def test_set_obswlen3(self):
     # with Quantity objects
     expected_result = TestLine.line.obswlen * u.micron
     line = spectro.Line(restwlen=1.282 * u.micron,
                         redshift=1.,
                         name='Pa_beta')
     line.set_obswlen()
     result = line.obswlen
     assert_equal(result, expected_result)
示例#4
0
 def test_init2(self):
     # full initialization
     expected_result = TestLine.expected_result
     line = spectro.Line(restwlen=1.282,
                         obswlen=2.564,
                         redshift=1.,
                         name='Pa_beta')
     result = [line.restwlen, line.obswlen, line.redshift, line.name]
     assert_list_equal(result, expected_result)
示例#5
0
 def test_init1(self):
     # empty initialization
     expected_result = [None, None, None, None]
     line = spectro.Line()
     result = [line.restwlen, line.obswlen, line.redshift, line.name]
     assert_list_equal(result, expected_result)
示例#6
0
 def setup(self):
     TestLine.newline = spectro.Line(restwlen=1.282,
                                     obswlen=2.564,
                                     redshift=1.,
                                     name='Pa_beta')
示例#7
0
 def setup_class(cls):
     TestLine.line = spectro.Line(restwlen=1.282,
                                  obswlen=2.564,
                                  redshift=1.,
                                  name='Pa_beta')
     TestLine.expected_result = [1.282, 2.564, 1., 'Pa_beta']