colour-runner icon indicating copy to clipboard operation
colour-runner copied to clipboard

Non-Django Example does not work

Open csarami opened this issue 5 years ago • 1 comments

Can you give me an example of what to import after installing the colour-runner 0.1.1 please?

it seems import colour_runner, does not work! Can you help me with this please?

factorial.py

import sys
def fact(n):
    """
    Factorial function

    :arg n: Number
    :returns: factorial of n

    """
    if n == 0:
        return 1
    return n * fact(n -1)

def div(n):
    """
    Just divide
    """
    res = 10 / n
    return res


def main(n):
    res = fact(n)
    print(res)

if __name__ == '__main__':
    if len(sys.argv) > 1:
        main(int(sys.argv[1]))`

now the factorial_test.py

import unittest
from factorial import fact
from unittest import runner

import colour_runner
class TestFactorial(unittest.TestCase):
    """
    Our basic test class
    """

    def test_fact(self):
        """
        The actual test.
        Any method which starts with ``test_`` will considered as a test case.
        """
        res = fact(5)
        self.assertEqual(res, 120)


if __name__ == '__main__':
    # unittest.main()
    runner = colour_runner.runner.ColourTextTestRunner()
    unittest.main(testRunner=runner, verbosity=2)`

csarami avatar Feb 23 '20 14:02 csarami

Hi @csarami. Could you please let me know what error you are getting?

meshy avatar Feb 23 '20 16:02 meshy