#!/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)
def test_negatives(self): self.assertEqual(prime_num(-10), "Only positive numbers are allowed")
#/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
def input_datatype_dict(self): self.assertEqual(prime_num({}), "Dictionary is not alllowed as an input")
def input_datatype_list(self): self.assertEqual(prime_num([]), "List is not allowed as input")
def test_zero_as_input(self): self.assertEqual(prime_num(0), "Zero is not a prime number")
def input_is_empty(self): self.assertEqual(prime_num(''), "You have not entered any number")
def test_one_as_input(self): self.assertEqual(prime_num(1), "One is not a prime number")
def test_too_long_input(self): self.assertEqual(prime_num(999999999999), "Input is too long.")
def test_float_input(self): self.assertEqual(prime_num(1.2), "Only integers to be used")
def test_string_input(self): self.assertEqual(prime_num("ten"), "Only numbers are allowed")
def test_output(self): self.assertEqual(prime_num(10), [2, 3, 5, 7])