GithubHelp home page GithubHelp logo

office-scripts's Introduction

hello-world

Readme

office-scripts's People

Contributors

manhar336 avatar

Stargazers

Nathan Basanese avatar

Watchers

 avatar

Forkers

v6

office-scripts's Issues

// , Test!

// , Write a test!

unittest is the batteries-included test module in the Python standard library. Its API will be familiar to anyone who has used any of the JUnit/nUnit/CppUnit series of tools.

Creating test cases is accomplished by subclassing unittest.TestCase.

import unittest

def fun(x):
    return x + 1

class MyTest(unittest.TestCase):
    def test(self):
        self.assertEqual(fun(3), 4)

-- http://docs.python-guide.org/en/latest/writing/tests/#the-basic

In this case, you would make a function like this:
In one file, hello_world.py, make this:

#!/usr/bin/env python3
def hello_world():
    return 'Hello, world!'

#Test: 
print ( hello_world() ) # If it prints Hello, world! then this program is working correctly.

If you feel strong and ambitious, try a more advanced test, perhaps.

In another file, test_hello_world.py, make a test like this:

import hello_world
import unittest # More details: https://docs.python.org/3/library/unittest.html

class TestHelloWorld(unittest.TestCase):
    def test_hello_world(self):
        self.assertEqual('Hello, world!', hello_world()) # For other programs, there are assertTrue() or assertFalse() to verify a condition; or assertRaises() to check an exception

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.