Exemple #1
0
#!/usr/bin/python
import prime
import prime_list
import prime_tuple
prime.prime_num(20)
prime_list.prime_list(1, 100)
prime_tuple.prime_tuple(1, 100)
Exemple #2
0
 def test_negatives(self):
     self.assertEqual(prime_num(-10), "Only positive numbers are allowed")
Exemple #3
0
#/bin/python

# http://projecteuler.net/problem=7

# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
# What is the 10 001st prime number?

import prime

print( prime.prime_num(10001) ) # 104743
Exemple #4
0
 def input_datatype_dict(self):
     self.assertEqual(prime_num({}),
                      "Dictionary is not alllowed as an input")
Exemple #5
0
 def input_datatype_list(self):
     self.assertEqual(prime_num([]), "List is not allowed as input")
Exemple #6
0
 def test_zero_as_input(self):
     self.assertEqual(prime_num(0), "Zero is not a prime number")
Exemple #7
0
 def input_is_empty(self):
     self.assertEqual(prime_num(''), "You have not entered any number")
Exemple #8
0
 def test_one_as_input(self):
     self.assertEqual(prime_num(1), "One is not a prime number")
Exemple #9
0
 def test_too_long_input(self):
     self.assertEqual(prime_num(999999999999), "Input is too long.")
Exemple #10
0
 def test_float_input(self):
     self.assertEqual(prime_num(1.2), "Only integers to be used")
Exemple #11
0
 def test_string_input(self):
     self.assertEqual(prime_num("ten"), "Only numbers are allowed")
Exemple #12
0
 def test_output(self):
     self.assertEqual(prime_num(10), [2, 3, 5, 7])