''' import pdb import pprint import my_module from my_module import my_json_data as my_data from my_module import my_json_data # 1. import my_module and the pretty print module # Add a breakpoint to test data pdb.set_trace() # 2. Use the gretting method from my_module to print out your name greet = my_module.greeting("Eugene") print(greet) pdb.set_trace() # 3. Use the letter_text module to print out a string letter = my_module.letter_text(name="Sam", amount="10,000", denomination="dollars") print(letter) pdb.set_trace() # 4. Use the my_module.my_json.data and print it out print(my_json_data) pdb.set_trace() # 5. Import the my_json_data as my_data and print out the my_data using pretty print
import my_module my_module.greeting() my_module.greeting('이주호') from my_module import greeting greeting('이재찬') print(my_module.pi) from my_module import pi as p print(my_module.pi) print(p)
import my_module print(my_module.greeting("Nitesh")) from my_module import greeting print(greeting("Nitesh")) from my_module import greeting, age print(greeting("Nitesh"), " Age = ", age) # Ctrl+k+c
def test_greeting_pass(): assert "Hello, Jordan" == greeting("Jordan"), "test failed"
def test_greeting_fail(): assert "Hello, Jordan" != greeting("Jordan"), "test failed"
import my_module # We can use dir() to find names that are defined inside a module dir(my_module) my_module.greeting('Samantha') my_module.add(1, 2, 3) # aliasing or renaming a module import num_module as nm dir(nm) nm.square(2) nm.tbl(3) from my_module2 import func1 func1 func1() # Built-in Modules # Mathematical Module import math as m # Value of PI m.pi
def test_greeting_male_name(prepare_specified_name): name = prepare_specified_name(sex='male') assert greeting(name) == 'Hello, Bob!'
import my_module print(my_module.greeting(" gaurav"))
def test_greeting(prepare_name): name = prepare_name assert greeting(name) == 'Hello, Bill!'
def test_greeting_fail(): """ Testing greeting function from my_module for fail """ assert my_module.greeting("") != "Hello Matt", "test failed"
def test_greeting_pass(): """ Testing greeting function from my_module for pass """ assert my_module.greeting("Matt") == "Hello Matt", "test failed"
import my_module print(my_module.greeting("Hello Prabhat Rai")) from my_module import greeting print(greeting("Prabhat")) from my_module import greeting, age print(greeting("Prabhat"), "Age =", age)
import my_module print(my_module.greeting("anugya"))
def test_greeting_pass(): assert "Hello Eugene" == greeting("Eugene"), "Test Failed" assert 100 != greeting("Eugene"), "Test Failed"
import my_module # accessing to the function in a module my_module.greeting('Metin') # accessing an object (dict) in a module p = my_module.person1 print(p)
def test_greeting_full_name(prepare_full_name): first_name, last_name = prepare_full_name name = first_name + " " + last_name assert greeting(name) == 'Hello, Bill Bob!'
# 1 # import my_module and pprint import pprint import my_module from my_module import my_json_data as my_data #see item #5 #add breakpoint to test your data breakpoint() #view the data in your variables to ensure they are correct # 2 # use the greeting method from my_module to print out your name print(my_module.greeting('Matt')) #add breakpoint to test your data breakpoint() #view the data in your variables to ensure they are correct # 3 # use the letter_text module to print out a string print(my_module.letter_text(name="Matt",amount="$100",denomination="USD")) #add breakpoint to test your data breakpoint() #view the data in your variables to ensure they are correct # 4 # use the my_module.my_json_data and print it out
Jordan Phillips Module 8 Assignment """ # 1. Import my_module and prettyprint # Add breakpoint to test your data # View the data in your variables to check import pprint import my_module # 2. Use the greeting method from my_module to print your name # Add breakpoint to test your data # View the data in your variables to check my_module.greeting("Jordan") breakpoint() # 3. Use letter_text function to print a string # Add breakpoint to test your data # View the data in your variables to check kwargs = { 'name': 'Jordan', 'amount': '500', 'denomination': 'dollars', } my_module.letter_text(**kwargs)