Ejemplo n.º 1
0
    def test_hello(self):
        stub_stdouts(self)

        hello_world.main()
        output = sys.stdout.getvalue().strip()
        assert "Hello" in output, \
            "Program output does not include \"Hello\".\n"
Ejemplo n.º 2
0
    def test_hello_world(self):
        stub_stdouts(self)

        hello_world.main()
        output = sys.stdout.getvalue().strip()
        assert output == "Hello World", \
            "Program does not output \"Hello World\".\n" \
                + "Expected: {}\n".format("Hello World") \
                + "Actual: {}\n".format(output)
Ejemplo n.º 3
0
def main():
    a = ''
    while a not in ('run','test'):
        print("Choose an option:\n\tRun\n\tTest")
        a = input("Your choice: ")
        a = a.lower()
    if a=="run":
        print("\n--Running Program--\n")
        student.main()
    elif a=="test":
        print("\n--Testing Program--\n")
        pytest.main(['-v'])
Ejemplo n.º 4
0
def test_hello_world(capfd):
    hello_world.main()
    out, _ = capfd.readouterr()
    assert out == 'Hello, World!\n'
Ejemplo n.º 5
0
import hello_world

# Invokes methods from package
hello_world.main()
hello_world.sayHello()
Ejemplo n.º 6
0
 def test_main(self):
     with mock.patch("sys.stdout", new_callable=io.StringIO) as stdout:
         expected = "Hello, World!\n"
         hello_world.main()
         self.assertEqual(stdout.getvalue(), expected)
Ejemplo n.º 7
0
 def setUp(self):
     from hello_world import main
     app = main({})
     from webtest import TestApp
     self.testapp = TestApp(app)
def test_main():
    assert type(h.main('Hello World!')) == int
Ejemplo n.º 9
0
def app(app_settings):
    return main({}, **app_settings)