I'm trying to write a unit test for a function within a class but I'm having a little trouble. Before moving the importer function into a class, this test worked. However, now I get TypeError: grab_column_locations missing 1 required positional argument: 'sheet'. The importer function itself is correctly getting parsing sheet and works correctly when the program is run, but not when tested.
The line the TypeError refers to in the importer function is:
columns = self.grab_column_locations(sheet)
The test that's failing is:
from unittest import TestCase
from gtt import GTT
class TestGTT(TestCase):
def test_importer(self):
"""
Test import of valid xlsx file
:return:
"""
file_list = ['testData_1.xls']
# Run Test 1
importer_results = GTT.importer(GTT, file_list)
assert importer_results[0] == True
So essentially, when run from a test, importerisn't passing sheetto grab_column_locations. This only started happening when I moved both of those functions into a class. I know I broke something somehow, but what?
Aucun commentaire:
Enregistrer un commentaire