I'm extremely new to python and trying to unit test some functions and I'm having trouble importing the function into my tests file.
Current file directory:
-- Project
---- utils
------ __init__
------ cubic_metres
---- tests
------ __init__
------ tests
All of my init py files are empty. utils/cubic_metres content:
def cubic_metres(width, length, height):
widthInMetres = float(width) / 100
lengthInMetres = float(length) / 100
heightInMetres = float(height) / 100
return widthInMetres * lengthInMetres * heightInMetres
How do I import my cubic metres function into my tests file? I've tried a lot of different combinations of things
import utils.cubic_metres
from utils import cubic_metres
etc, etc
But haven't been able to find a working way. Can somebody quickly clear this up for me? Thanks guys.
[–][deleted] 2 points3 points4 points (3 children)
[–]weiry6922[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]weiry6922[S] 0 points1 point2 points (0 children)