def test_hello(self): self.assertEqual(hello_world.hello(), 'Hello, World!')
def test_hello_with_name(self): self.assertEqual( 'Hello, Jane!', hello_world.hello('Jane') )
def test_hello(self): value = hello() self.assertEqual(value, 'Hello!!!')
def test_hello_with_other_sample_name(self): self.assertEqual("Hello, Bob!", hello_world.hello("Bob"))
def test_hello_with_blank_name(self): self.assertEqual( 'Hello, World!', hello_world.hello('') )
def test_say_hello(): assert hello() == "Hello, World!"
def test_hello_with_umlaut_name(self): self.assertEqual('Hello, Jürgen!', hello_world.hello('Jürgen'))
def test_say_hello(self): expected = 'Hello World!' self.assertEqual(hello(), expected)
#!/usr/bin/env python3 import hello_world hello_world.test() a = hello_world.add(1, 2) print(a) hello_world.hello(3)
def test_hello_without_name(): assert 'Hello, World!' == hello_world.hello()
def test_hello(self): """Test to assert hello_world function return expected result""" self.assertEqual(hello_world.hello(), 'Hello, World!')
def test_hello_with_none_name(): assert 'Hello, World!' == hello_world.hello(None)
def test_hello_with_blank_name(): assert 'Hello, World!' == hello_world.hello('')
def test_hello_with_umlaut_name(self): self.assertEqual("Hello, Jürgen!", hello_world.hello("Jürgen"))
def test_hello_with_sample_name(self): self.assertEqual( 'Hello, Alice!', hello_world.hello('Alice') )
print(result.stderr.decode("utf-8")) # Let's make a listing of the file's content. # In[ ]: with open(pyfile, 'r') as f: print(f.read()) # Let's import the file as a Python module and use the embedded functions. If the name of the file is fixed and known, then the usual Python `import` statement will do the job. # In[ ]: import hello_world help(hello_world) hello_world.hello() # If the name of the python file is given as the value of a Python string variable then the standard library `importlib` may be used. Note the need to strip any suffix from a file name. # In[ ]: import importlib mymodule = importlib.import_module(pyfile.rstrip(".py")) help(mymodule) mymodule.hello() # For platforms where the shell escape `!` might fail, an alternative is to use the standard Python `subprocess` library. # ## Method 2. Cloning a git repository # # Downloading a collection of files from a git repository with `wget` (or `curl`) can be cumbersome, particularly if the names of the individual files are unknown or subject to change. And, unfortunately, Github does not provide an API for accessing a folder of files.
def test_hello_with_umlaut_name(self): self.assertEqual( 'Hello, Jürgen!', hello_world.hello('Jürgen') )
def app(): print("This is my app") hello() print(sum("Over", "Watch"))
def test_hello_with_sample_name(self): self.assertEqual('Hello, Alice!', hello_world.hello('Alice'))
def app(): print("This is my app") hello_world.hello() print(hello_world.sum("Over", "Watch"))
def test_hello_with_none_name(self): self.assertEqual('Hello, World!', hello_world.hello(None))
def test_hellojanine(self): self.assertEqual(hello_world.hello("Janine"), 'Hello, Janine!')
def test_answer(): assert hello() == "hello world"
def test_hello_no_name(self): self.assertEqual( # nice multi line situation you got here 'Hello, World!', # expected behavior hello_world.hello() # hello_world.py module, hello() func w no args )
def test_hello_with_none_name(self): self.assertEqual( 'Hello, World!', hello_world.hello(None) )
def test_hello_name_given(self): self.assertEqual( 'Hello, Ol Eleven Bearings!', # will use whatever we put in for the test! hello_world.hello('Ol Eleven Bearings') )
def test_hello_unicode(self): self.assertEqual('Ʉ', hello_world.hello('u')) self.assertEqual('wərd', hello_world.hello('word'))
def test_hello_utf_brayka(self): self.assertEqual( 'Hello, Evgénya!', hello_world.hello('Evgénya') )
def test_hello_o_thor(self): self.assertEqual( 'Hello, BOBZOR!', hello_world.hello('BOBZOR') )
def test_say_hi(self): self.assertEqual(hello(), "Hello, World!")
import hello_world ret = hello_world.hello('tester') print ret
def test_hello_with_other_sample_name(self): self.assertEqual( 'Hello, Bob!', hello_world.hello('Bob') )
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest import hello_world class HelloWorldTests(unittest.TestCase): def test_hello_without_name(self): self.assertEqual('Hello, World!', hello_world.hello()) def test_hello_with_sample_name(self): self.assertEqual('Hello, Alice!', hello_world.hello('Alice')) def test_hello_with_other_sample_name(self): self.assertEqual('Hello, Bob!', hello_world.hello('Bob')) def test_hello_with_umlaut_name(self): self.assertEqual('Hello, Jürgen!', hello_world.hello('Jürgen')) if __name__ == '__main__': hello_world.hello('Bob') unittest.main()
def test_hello_without_name(self): self.assertEqual( 'Hello, World!', hello_world.hello() )
def test_2(): assert student.hello('NUAMES', 14) == 'Hello World!\nNUAMES\nPeriod 14'
def test_greeting_message(self): self.assertEqual(hello_world.hello(), 'Hello, World!')
def test_1(): assert student.hello('Mr. Simonsen', 1) == 'Hello World!\nMr. Simonsen\nPeriod 1'
def test_hello_with_other_sample_name(self): self.assertEqual('Hello, Bob!', hello_world.hello('Bob'))
import unittest from hello_world import hello # Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0 hello() #class HelloWorldTest(unittest.TestCase): # def test_say_hi(self): # self.assertEqual(hello(), "Hello, World!") #if __name__ == "__main__": # unittest.main()
def test_hello_with_blank_name(self): self.assertEqual('Hello, World!', hello_world.hello(''))
def test_hello_world(): assert isinstance(hello(), str)
def test_hello_without_name(self): self.assertEqual('Hello, World!', hello_world.hello())
def test_hello_with_sample_name(self): self.assertEqual("Hello, Alice!", hello_world.hello("Alice"))