示例#1
0
 def test_build_reference_items(self):
     items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
     obs1, obs2 = build_reference(items, 3)
     self.assertEqual(len(obs1), 3)
     self.assertEqual(len(obs2), 7)
     #check that the ref and nonref are same
     for num in obs1:
         if num not in items:
             raise AssertionError(str(num) + " not in expected!")
     for num in obs2:
         if num not in items:
             raise AssertionError(str(num) + " not in expected!")
     for num in items:
         if num not in obs1 and num not in obs2:
             raise AssertionError(str(num) + " not in observed!")
示例#2
0
 def test_build_reference_dupes(self):
     items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
     obs1, obs2 = build_reference(items, 3)
     self.assertEqual(len(obs1), 3)
     self.assertEqual(len(obs2), 7)
     #check that the ref and nonref are same
     finals = set([])
     for item in obs1:
         if item in finals:
             raise AssertionError("Duplicate in reference!")
         finals.add(item)
     for item in obs2:
         if item in finals:
             raise AssertionError("Duplicate in nonreference!")
         finals.add(item)        
示例#3
0
 def test_build_reference_dupes(self):
     """Tests whether duplicates introduced by build_reference"""
     items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
     obs1, obs2 = build_reference(items, 3)
     self.assertEqual(len(obs1), 3)
     self.assertEqual(len(obs2), 7)
     #check that the ref and nonref are same
     finals = set([])
     for item in obs1:
         if item in finals:
             raise AssertionError("Duplicate in reference!")
         finals.add(item)
     for item in obs2:
         if item in finals:
             raise AssertionError("Duplicate in nonreference!")
         finals.add(item)
示例#4
0
 def test_build_reference_items(self):
     """Tests whether items in build_reference ref and nonref lists are
     correct """
     items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
     obs1, obs2 = build_reference(items, 3)
     self.assertEqual(len(obs1), 3)
     self.assertEqual(len(obs2), 7)
     #check that the ref and nonref are same
     for num in obs1:
         if num not in items or num in obs2:
             raise AssertionError(str(num) + " not expected in ref!")
     for num in obs2:
         if num not in items or num in obs1:
             raise AssertionError(str(num) + " not expected in nonref!")
     for num in items:
         if num not in obs1 and num not in obs2:
             raise AssertionError(str(num) + " not observed!")
示例#5
0
 def test_build_reference_items(self):
     """Tests whether items in build_reference ref and nonref lists are
     correct """
     items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
     obs1, obs2 = build_reference(items, 3)
     self.assertEqual(len(obs1), 3)
     self.assertEqual(len(obs2), 7)
     #check that the ref and nonref are same
     for num in obs1:
         if num not in items or num in obs2:
             raise AssertionError(str(num) + " not expected in ref!")
     for num in obs2:
         if num not in items or num in obs1:
             raise AssertionError(str(num) + " not expected in nonref!")
     for num in items:
         if num not in obs1 and num not in obs2:
             raise AssertionError(str(num) + " not observed!")
示例#6
0
 def test_build_reference_lengths(self):
     items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
     obs1, obs2 = build_reference(items, 3)
     self.assertEqual(len(obs1), 3)
     self.assertEqual(len(obs2), 7)
示例#7
0
 def test_build_reference_lengths(self):
     """Tests build_reference creates proper length ref and nonref lists"""
     items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
     obs1, obs2 = build_reference(items, 3)
     self.assertEqual(len(obs1), 3)
     self.assertEqual(len(obs2), 7)
示例#8
0
 def test_build_reference_lengths(self):
     """Tests build_reference creates proper length ref and nonref lists"""
     items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
     obs1, obs2 = build_reference(items, 3)
     self.assertEqual(len(obs1), 3)
     self.assertEqual(len(obs2), 7)