Пример #1
0
    def test_negative_numbers(self):

        squares = {-1: 1, -2: 4, -3: 9, -12: 144, -100: 10000}

        for num, square in squares.items():
            self.assertEqual(square, Squarer.calc(num),
                             "Squaring {}.".format(num))
Пример #2
0
    def test_positive_numbers(self):

        squares = {1: 1, 2: 4, 3: 9, 12: 144, 100: 10000}

        for num, square in squares.items():
            self.assertEqual(square, Squarer.calc(num),
                             "Squaring {}.".format(num))
Пример #3
0
class SquarerTest():
    
    @staticmethod
    
            result = Squarer.calc(num)
            
            if result != square:
                print("Squared {} and got {} but expected {}.".format(num,
                      result, square))
Пример #4
0
    def test_positive_numbers():

        squares = {1: 1, 2: 4, 3: 9, 12: 144, 100: 10000}

        for num, square in squares.items():
            result = Squarer.calc(num)

            if result != square:
                print('Squared {} and got {} but was expecting {}'.format(
                    num, result, square))
Пример #5
0
 def test_negative_numbers():
     squares = {-1: 1,
                -2: 4,
                -3: 9,
                -12: 144,
                -100: 10000}
     
     for num, square in squares.items():
         result = Squarer.calc(num)
         
         if result != square:
             print("Squared {} and got {} but expected {}.".format(num,
                   result, square))
Пример #6
0
    def test_positive_numbers():

        squares = {
            1: 1,
            2: 4,
            3: 9,
            12: 144,
            100: 10000,
        }

        for num, square in squares.items():
            result = Squarer.calc(num)

            if result != square:
                print("Squared {}, act {} exp {}".format(num, result, square))
Пример #7
0
    def test_negative_numbers():

        squares = {
            -1: 1,
            -2: 4,
            -3: 9,
            -12: 144,
            -100: 10000,
        }

        for num, square in squares.items():
            result = Squarer.calc(num)

            if result != square:
                print("Squared {}, act {} exp {}".format(num, result, square))
Пример #8
0
    def test_positive_numbers(self):
        """
        Method: Test with + numbers.
        """
        squares = {
            1: 1,
            2: 4,
            3: 9,
            12: 144,
            100: 10000,
        }

        for num, square in squares.items():
            self.assertEqual(square, Squarer.calc(num),
                             "Squaring {}".format(num))
Пример #9
0
    def test_negative_numbers(self):
        """
        Method: Test with - numbers.
        """

        squares = {
            -1: 1,
            -2: 4,
            -3: 9,
            -12: 144,
            -100: 10000,
        }

        for num, square in squares.items():
            self.assertEqual(square, Squarer.calc(num),
                             "Squaring {}".format(num))
Пример #10
0
    def test_positive_numbers():
        """
        Method: Test with + numbers.
        """
        squares = {
            1: 1,
            2: 4,
            3: 9,
            12: 144,
            100: 10000,
        }

        for num, square in squares.items():
            result = Squarer.calc(num)

            if result != square:
                print("Squared {} and got {} but expected {}".format(
                    num, result, square))
Пример #11
0
    def test_positive_numbers():
        """The goal of this script is to define the expected behavior of Squarer and test
                quarer against that expected behavior. So we begin by creating a dictionary that
                defines that behavior:"""

        squares = {
            1: 1,
            2: 4,
            3: 9,
            12: 144,
            100: 10000,
        }

        for num, square in squares.items():
            result = Squarer.calc(num)

            if result != square:
                print("Squared {} and got {} but expected {}".format(
                    num, result, square))
Пример #12
0
 def test_pos_nums(self):
     squares = {1: 1, 2: 4, 3: 9, 100: 10000}
     for num, square in squares.items():
         self.assertEqual(Squarer.calc(num), square,
                          "Squaring {}".format(num))
Пример #13
0
 def test_neg_nums(self):
     neg_squares = {-1: 1, -2: 4, -3: 9, -100: 10000}
     for num, square in neg_squares.items():
         self.assertEqual(Squarer.calc(num), square,
                          "Negative: squaring {}".format(num))
Пример #14
0
from squarer import Squarer

class SquarerTest(unittest.TestCase):

    def test_positive_numbers(self):

        squares # {
            1: 1,
            2: 4,
            3: 9,
            12: 144,
            100: 10000,
        }

        for num, square in squares.items():
            self.assertEqual(square, Squarer.calc(num), "Squaring {}".format(num));

    def test_negative_numbers(self):

        squares # {
            -1: 1,
            -2: 4,
            -3: 9,
            -12: 144,
            -100: 10000,
        }

        for num, square in squares.items():
            self.assertEqual(square, Squarer.calc(num), "Squaring {}".format(num));