コード例 #1
0
 def test_get_best_fields_5(self):
     #two different fields with same origin and same number of subfields but different length of the subfields strings
     fields1 = [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'ISI')], 'C', '5', '', 31)]
     fields2 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, 389'), ('e', '1')], 'C', '5', '', 22)]
     out = ([([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, 389'), ('e', '1')], 'C', '5', '', 22)],
            [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'ISI')], 'C', '5', '', 31)])
     self.assertEqual(m._get_best_fields(fields1, fields2, '100'), out)
コード例 #2
0
 def test_get_best_fields_6(self):
     #two different fields with same origin and same number of subfields and same length of the subfields strings but different content of the strings
     fields1 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, FOO'), ('e', '1')], 'C', '5', '', 22)]
     fields2 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, BAR'), ('e', '1')], 'C', '5', '', 22)]
     #self.assertRaises(EqualFields, m._get_best_fields, fields1, fields2, '100')
     out = (fields1, fields2)
     self.assertEqual(m._get_best_fields(fields1, fields2, '100'), out)
コード例 #3
0
 def test_get_best_fields_1(self):
     #same field with different origin
     fields1 = [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'BAAA')], 'C', '5', '', 31)]
     fields2 = [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'AUTHOR')], 'C', '5', '', 31)]
     out = ([([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'BAAA')], 'C', '5', '', 31)], 
            [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'AUTHOR')], 'C', '5', '', 31)])
     self.assertEqual(m._get_best_fields(fields1, fields2, '100'), out)
コード例 #4
0
 def test_get_best_fields(self):
     #exactly same field
     fields1 = [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'ISI')], 'C', '5', '', 31)]
     fields2 = [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'ISI')], 'C', '5', '', 31)]
     out = ([([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'ISI')], 'C', '5', '', 31)],
            [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'ISI')], 'C', '5', '', 31)])
     self.assertEqual(m._get_best_fields(fields1, fields2, '100'), out)
コード例 #5
0
 def test_get_best_fields_8(self):
     #same as test 7 but with one both fields with primary = False
     fields1 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, FOO'), ('e', '1'), ('99', 'False')], 'C', '5', '', 22)]
     fields2 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, BAR'), ('e', '1'), ('99', 'False')], 'C', '5', '', 22)]
     #self.assertRaises(EqualFields, m._get_best_fields, fields1, fields2, '100')
     out = (fields1, fields2)
     self.assertEqual(m._get_best_fields(fields1, fields2, '100'), out)
コード例 #6
0
 def test_get_best_fields_9(self):
     #same as test 8 but different timestamps
     fields1 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, FOO'), ('e', '1'), 
                  ('97', '2011-05-04T11:29:27'), ('98', '2011-05-04T11:29:27'),('99', 'False')], 'C', '5', '', 22)]
     fields2 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, BAR'), ('e', '1'), 
                  ('97', '2012-05-04T11:29:27'),('98', '2012-05-04T11:29:27'), ('99', 'False')], 'C', '5', '', 22)]
     out = (fields2, fields1)
     self.assertEqual(m._get_best_fields(fields1, fields2, '100'), out)
コード例 #7
0
 def test_get_best_fields_3(self):
     #different origin and different number of fields
     fields1 = [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'BAAA')], 'C', '5', '', 31),
                ([('i', '1965fake...91....1K'), ('e', '1'), ('b', '1965fake...91....1K'), ('7', 'BAAA')], 'C', '5', '', 31)]
     fields2 = [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'AUTHOR')], 'C', '5', '', 31)]
     out = ([([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'BAAA')], 'C', '5', '', 31),
             ([('i', '1965fake...91....1K'), ('e', '1'), ('b', '1965fake...91....1K'), ('7', 'BAAA')], 'C', '5', '', 31)],
            [([('i', '1965IBVS...91....1K'), ('e', '1'), ('b', '1965IBVS...91....1K'), ('7', 'AUTHOR')], 'C', '5', '', 31)])
     self.assertEqual(m._get_best_fields(fields1, fields2, '100'), out)
コード例 #8
0
 def test_get_best_fields_10(self):
     #same as test 9 but same timestamps
     fields1 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, FOO'), ('e', '1'), 
                  ('97', '2011-05-04T11:29:27'), ('98', '2011-05-04T11:29:27'),('99', 'False')], 'C', '5', '', 22)]
     fields2 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, BAR'), ('e', '1'), 
                  ('97', '2011-05-04T11:29:27'), ('98', '2011-05-04T11:29:27'), ('99', 'False')], 'C', '5', '', 22)]
     #self.assertRaises(EqualFields, m._get_best_fields, fields1, fields2, '100')
     out = (fields1, fields2)
     self.assertEqual(m._get_best_fields(fields1, fields2, '100'), out)
コード例 #9
0
 def test_get_best_fields_7(self):
     #same as test 6 but with one field with primary = TRUE
     fields1 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, FOO'), ('e', '1'), ('99', 'False')], 'C', '5', '', 22)]
     fields2 = [([('i', '1982A&A...105..389V'), ('7', 'ISI'), ('b', 'Van Hamme, W.:1982, Astron. Astrophys. 105, BAR'), ('e', '1'), ('99', 'True')], 'C', '5', '', 22)]
     out = (fields2, fields1)
     self.assertEqual(m._get_best_fields(fields1, fields2, '100'), out)