Esempio n. 1
0
def test_main_error_with_empty_string(capsys):
    with pytest.raises(SystemExit) as excinfo:
        hello.main([''])

    retv, = excinfo.value.args
    assert retv == 1

    out, err = capsys.readouterr()
    assert out == ''
    assert err == "Person's name must not be empty!\n"
Esempio n. 2
0
def main():
    print("This is the test of test() in hello.py: ")
    hello.test()

    print("This is the test of main() in hello.py: ")
    hello.main()

    print("This is the test of class Hello in hello.py: ")
    tmp = hello.Hello()
    tmp.show_string()

    print("This is the test of class Hello via \"from hello import Hello\"")
    tmp = Hello()
    tmp.show_string()
Esempio n. 3
0
def test_main_error_with_emptystring(capsys):

    assert hello.main([''])

    out, err = capsys.readouterr()
    assert out == ''
    assert err == "Persons's name must not be empty\n"
Esempio n. 4
0
def test_main(cloud_config, capsys):
    table_name = TABLE_NAME_FORMAT.format(
        random.randrange(TABLE_NAME_RANGE))
    main(
        cloud_config.project,
        cloud_config.bigtable_cluster,
        cloud_config.bigtable_zone,
        table_name)

    out, _ = capsys.readouterr()
    assert re.search(
        re.compile(r'Creating the Hello-Bigtable-[0-9]+ table\.'), out)
    assert re.search(re.compile(r'Writing some greetings to the table\.'), out)
    assert re.search(re.compile(r'Scanning for all greetings'), out)
    assert re.search(re.compile(r'greeting0: Hello World!'), out)
    assert re.search(
        re.compile(r'Deleting the Hello-Bigtable-[0-9]+ table\.'), out)
Esempio n. 5
0
 def test_hello2(self):
     self.assertEqual(hello.main("hello2"), "Hello World2\n")
Esempio n. 6
0
import hello
import repeat
hello.main()

s = 'shit'
exclaim = 'true'

print repeat.repeat(s, exclaim)
print '-' * 10
Esempio n. 7
0
def test_main(capsys):
    hello.main()
    output, _ = capsys.readouterr()
    assert output == "Hello, World!\n"
Esempio n. 8
0
from hello import square
from hello import main

print(square(10))
print(main(10))
def test_hello(capsys):
    main()
    captured = capsys.readouterr()
    assert captured.out == "Hello, instructor!\n"
Esempio n. 10
0
def test_main(capsys):
    hello.main(['Joon'])

    out, err = capsys.readouterr()
    assert out == 'Hello Joon\n'
    assert err == ''
Esempio n. 11
0
 def setUp(self):
     from hello import main
     app = main({})
     from webtest import TestApp
     self.testapp = TestApp(app)
Esempio n. 12
0
def test_hello():
    assert hello.main() == "Hello World!"
Esempio n. 13
0
def test_main(capsys):
    hello.main(['Anthony'])

    out, err = capsys.readouterr()
    assert out == 'Hello Sexy Person Anthony\n'
    assert err == ''
Esempio n. 14
0
 def test_hello(self):
     self.assertEqual(hello.main("hello"), "Hello World\n")
Esempio n. 15
0
def test_main():
    assert main() == 2
Esempio n. 16
0
import hello
import repeat
hello.main()

s = 'shit'
exclaim='true'

print repeat.repeat(s,exclaim)
print '-'*10
def test_says_world():
    assert hello.main() == 0