Sha256: 859bb3a236809a09e5e20ad92e2bc1bc39be8b01188bf552abf695a9724ad0a1

Contents?: true

Size: 1.13 KB

Versions: 86

Compression:

Stored size: 1.13 KB

Contents

import unittest

from armstrong_numbers import is_armstrong


# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0

class ArmstrongTests(unittest.TestCase):

    def test_single_digit_numbers_are_armstrong_numbers(self):
        self.assertIs(is_armstrong(5), True)

    def test_there_are_no_two_digit_armstrong_numbers(self):
        self.assertIs(is_armstrong(10), False)

    def test_three_digit_number_that_is_an_armstrong_number(self):
        self.assertIs(is_armstrong(153), True)

    def test_three_digit_number_that_is_not_an_armstrong_number(self):
        self.assertIs(is_armstrong(100), False)

    def test_four_digit_number_that_is_an_armstrong_number(self):
        self.assertIs(is_armstrong(9474), True)

    def test_four_digit_number_that_is_not_an_armstrong_number(self):
        self.assertIs(is_armstrong(9475), False)

    def test_seven_digit_number_that_is_an_armstrong_number(self):
        self.assertIs(is_armstrong(9926315), True)

    def test_seven_digit_number_that_is_not_an_armstrong_number(self):
        self.assertIs(is_armstrong(9926314), False)


if __name__ == '__main__':
    unittest.main()

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
trackler-2.2.1.160 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.159 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.158 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.157 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.156 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.155 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.154 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.153 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.152 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.151 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.150 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.149 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.148 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.147 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.146 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.145 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.144 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.143 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.142 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py
trackler-2.2.1.141 tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py