예제 #1
0
class TotalMagicNumbers(object):
    def __init__(self):
        self.magicNumbers = CalculateMagicNumbers()

    def calculate(self, data=[]):

        result = 0

        for numbers in data:
            init = numbers[0]
            end = numbers[1]

            result += self.magicNumbers.calculate(init, end)

        return result
예제 #2
0
 def __init__(self):
     self.magicNumbers = CalculateMagicNumbers()
 def test_is_not_square(self):
     magic_number = CalculateMagicNumbers()
     self.assertEqual(magic_number.haveSquare(10), False)
 def test_calculate_magic_numbers(self):
     init = 8
     end = 27
     magic_number = CalculateMagicNumbers()
     self.assertEqual(magic_number.calculate(init, end), 2)
 def test_is_not_prime(self):
     magic_number = CalculateMagicNumbers()
     self.assertEqual(magic_number.isPrime(10), False)
 def test_is_not_magic_number(self):
     magic_number = CalculateMagicNumbers()
     self.assertEqual(magic_number.isMagicNumber(100), False)
 def test_is_square(self):
     magic_number = CalculateMagicNumbers()
     self.assertEqual(magic_number.haveSquare(100), True)
 def test_is_prime(self):
     magic_number = CalculateMagicNumbers()
     self.assertEqual(magic_number.isPrime(3), True)
 def test_is_magic_number(self):
     magic_number = CalculateMagicNumbers()
     self.assertEqual(magic_number.isMagicNumber(9), True)