Skip to content

Latest commit

 

History

History
103 lines (84 loc) · 1.77 KB

File metadata and controls

103 lines (84 loc) · 1.77 KB

img

Test driven development quizes

Question #0

Is this module correctly documented?

#!/usr/bin/python3
""" 
    My calculation module
"""
import sys
...
  • Yes
  • No

Question #1

Based on this code, what should all the test cases be? (select multiple)

def uniq(list):
    """ Returns unique values of a list """
    u_list = []
    for item in list:
        if item not in u_list:
            u_list.append(item)
    return u_list
  • list with 2 different element (same type)
  • not a list argument (ex: passing a dictionary to the method)
  • list with more than 2 times the same element (same type)
  • list with one element (any type)
  • empty list
  • list with multiple types (integer, string, etc…)
  • list with twice the same element (same type)

Question #2

Is this a standardized way to comment a function in Python?

"""" Addition function """
def add(a, b):
    return a + b
  • Yes
  • No

Question #3

Is this a standardized way to comment a function in Python?

##########
# Addition function
##########
def add(a, b):
    return a + b
  • Yes
  • No

Question #4

Is this a standardized way to comment a function in Python?

/* Addition function */
def add(a, b):
    return a + b
  • Yes
  • No

Question #5

Is this module correctly commented?

#!/usr/bin/python3
import sys

""" 
    My calculation module
"""
...
  • Yes
  • No

Tips

Docstrings must be bofore import statments

Question #6

Is this a standardized way to comment a function in Python?

def add(a, b):
    """ Addition function """
    return a + b
  • Yes
  • No