Test driven development quizes
Is this module correctly documented?
#!/usr/bin/python3
"""
My calculation module
"""
import sys
...- Yes
- No
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)
Is this a standardized way to comment a function in Python?
"""" Addition function """
def add(a, b):
return a + b- Yes
- No
Is this a standardized way to comment a function in Python?
##########
# Addition function
##########
def add(a, b):
return a + b- Yes
- No
Is this a standardized way to comment a function in Python?
/* Addition function */
def add(a, b):
return a + b- Yes
- No
Is this module correctly commented?
#!/usr/bin/python3
import sys
"""
My calculation module
"""
...- Yes
- No
Docstrings must be bofore import statments
Is this a standardized way to comment a function in Python?
def add(a, b):
""" Addition function """
return a + b- Yes
- No
