예제 #1
0
파일: quine.py 프로젝트: em1382/algorithms
def main():
    program = ["def sayHello():", "\n\tprint('Hello World!')"]
    f = open('hello.py', 'w+')
    for line in program:
        f.write(line)
    f.close()

    import hello
    hello.sayHello()
 def test_sayHello_name(self):
     result = hello.sayHello("Alex")
     self.assertEqual(result, "Hello, Alex")
예제 #3
0
 def test_hello(self):
     self.assertEqual(hello.sayHello(), "Hello World!!")
예제 #4
0
파일: main.py 프로젝트: g105b/hello-you
import hello

print hello.sayHello()

print hello.sayName("Martyn")
예제 #5
0
def test_say_hello_with_input():
    # Override the Python built-in input method
    hello.input = lambda x: 'Python'
    output = hello.sayHello()
    assert 'Hello Python, nice to meet you!' == output
예제 #6
0
def test_say_hello_without_input_with_mock():
    with mock.patch.object(hello, 'input', lambda x: ''):
        output = sayHello()
    assert 'Hello World' == output
예제 #7
0
def test_say_hello_with_input_with_mock():
    with mock.patch.object(hello, 'input', lambda x: 'Python'):
        output = sayHello()
    assert 'Hello Python, nice to meet you!' == output
 def test_sayHello_to_nobody(self):
     with self.assertRaises(Exception):
         hello.sayHello("")
 def test_SayHello(self):
     # If the method returns "Hello World!", then the test will pass
     self.assertEqual(hello.sayHello(),"Hello World!")
예제 #10
0
 def test_sayHello_without_title(self):
     result = hello.sayHello("Senko")
     self.assertEqual(result, "Hello Mr. Senko")
예제 #11
0
 def test_sayHello_with_title(self):
     result = hello.sayHello("Senko", title="The Misterious")
     self.assertEqual(result, "Hello The Misterious Senko")
import hello

name = input("What is your name? ").title()
print("You have terminal cancer")
hello.sayHello(name)
print("You Gay")
hello.sayBye(name)
 def test_sayHello_to_one_person(self):
     result = hello.sayHello("Alex")
     self.assertEqual(result, "Hello, Alex")
 def test_sayHello_to_many_people(self):
     with self.assertRaises(Exception):
         hello.sayHello("Alex,Krasi")
 def test_sayHello_name_with_greeting(self):
     result = hello.sayHello("Alex", "Happy testing")
     self.assertEqual(result, "Happy testing, Alex")
예제 #16
0
def test_say_hello_without_input():
    # Override the Python built-in input method
    hello.input = lambda x: ''
    output = hello.sayHello()
    assert 'Hello World' == output
예제 #17
0
# test.py

import hello 

hello.sayHello()
예제 #18
0
import hello
hello.sayHello()
hello.sayHello('zy')