def test_composite_request(self): prime3.prime_gen(10) with self.assertRaises(Exception): prime3.get_ordinal(8)
def test_policy_1(self): prime3.index_policy = 1 prime3.largest_under(10) prime3.get_ordinal(13) prime3.is_prime(17) self.assertEqual({2:1, 7:4, 13:6, 17:7}, prime3.ordinal_index)
def test_normal_usage(self): prime3.prime_gen(541) self.assertEqual(prime3.get_ordinal(541), 100)
def test_float(self): with self.assertRaises(Exception): prime3.get_ordinal(13.7)
def test_policy_1(self): prime3.index_policy = 1 prime3.largest_under(10) prime3.get_ordinal(13) prime3.is_prime(17) self.assertEqual({2: 1, 7: 4, 13: 6, 17: 7}, prime3.ordinal_index)