Exemplo n.º 1
0
 def test_tier_subtraction_empty_first(self):
     t1 = TierSet()
     l2 = self.list_to_tier_initializer([[1, 2, 3, 4], None, None, None,
                                         None, [7], None])
     t2 = TierSet(l2)
     t1 -= t2
     for t in Tier:
         self.assertEqual(set(), t1._tiers[t])
Exemplo n.º 2
0
 def test_tier_subtraction_overlapped(self):
     l = self.list_to_tier_initializer([[1, 2, 3, 4], None, [3, 4, 5, 6, 7],
                                        None, None, None, None])
     t1 = TierSet(l)
     t2 = TierSet(l)
     t1 -= t2
     for t in Tier:
         if l.get(t, None):
             self.assertEqual(set(), t1[t])
Exemplo n.º 3
0
 def test_tier_subtraction_empty_second(self):
     l1 = self.list_to_tier_initializer([[1, 2, 3, 4], [5, 8, 1], None,
                                         None, None, None, None])
     t1 = TierSet(l1)
     t2 = TierSet()
     t1 -= t2
     for t in Tier:
         if l1.get(t, None):
             self.assertEqual(set(l1[t]), t1[t])
         else:
             self.assertEqual(set(), t1._tiers[t])
Exemplo n.º 4
0
 def test_tier_addition_overlapped(self):
     l1 = self.list_to_tier_initializer([[1, 2, 3, 4], None, None, None,
                                         None, None, None])
     t1 = TierSet(l1)
     t2 = TierSet(l1)
     t1 += t2
     for t in Tier:
         if l1.get(t, None):
             self.assertEqual(set(l1[t]), t1[t])
         else:
             self.assertEqual(set(), t1._tiers[t])
Exemplo n.º 5
0
 def test_tier_addition_disjoint(self):
     l1 = self.list_to_tier_initializer([[1, 2, 3, 4], None, None, None,
                                         None, None, None])
     t1 = TierSet(l1)
     l2 = self.list_to_tier_initializer([[5, 6, 7, 8], None, None, None,
                                         None, None, None])
     t2 = TierSet(l2)
     target = self.list_to_tier_initializer([[1, 2, 3, 4, 5, 6, 7, 8], None,
                                             None, None, None, None, None])
     t1 += t2
     for t in Tier:
         if target.get(t, None):
             self.assertEqual(set(target[t]), t1[t])
         else:
             self.assertEqual(set(), t1._tiers[t])
Exemplo n.º 6
0
 def test_tier_addition_not_overlapped(self):
     l1 = self.list_to_tier_initializer([[1, 2, 3, 4], None, None, None,
                                         None, None, None])
     t1 = TierSet(l1)
     l2 = self.list_to_tier_initializer(
         [None, [1, 2, 3, 4], None, None, None, None, None])
     t2 = TierSet(l2)
     target = self.list_to_tier_initializer([[1, 2, 3, 4], [1, 2, 3, 4],
                                             None, None, None, None, None])
     t1 += t2
     for t in Tier:
         if target.get(t, None):
             self.assertEqual(target[t], t1[t])
         else:
             self.assertEqual(set(), t1._tiers[t])
Exemplo n.º 7
0
 def test_initialized_tier(self):
     l = self.list_to_tier_initializer([[1, 2, 3, 4, 5, 6], None, None,
                                        [2, 3, 4], None, None, [
                                            1,
                                        ]])
     t = TierSet(l)
     for tier in Tier:
         if l.get(tier, None):
             self.assertEqual(set(l[tier]), t[tier])
         else:
             self.assertEqual(set(), t._tiers[tier])
Exemplo n.º 8
0
 def test_autoinit_on_get(self):
     tier = TierSet()
     self.assertEqual(0, len(tier._tiers))
     for t in Tier:
         self.assertEqual(set(), tier[t])
     self.assertEqual(7, len(tier._tiers))