def test_populateTable(self, inputSource, testFileGDB): obj = DataFrameToTable(inputSource, 'test', testFileGDB) conversionDict = obj.createTableAndAddFields() try: obj.populateTable(conversionDict) except Exception as e: logging.exception(e) assert False else: assert True
def test_createTableAndAddFields(self, inputSource, testFileGDB): obj = DataFrameToTable(inputSource, 'test', testFileGDB) try: obj.createTableAndAddFields() except Exception as e: logging.exception(e) assert False else: assert True
def test_getArcpyTypesAndConversionFromDf(self, paramsAndOutcome): """ Verifies the efficacy of this conversion function :param tuple paramsAndOutcome: ({inputColName: inputColType}, {expectedOutColName: expectedOutColType}, {expectedOutColName: inputColName}) """ colAndType = paramsAndOutcome[0] expectedArcpySafe = paramsAndOutcome[1] expectedConversionDict = { list(expectedArcpySafe.keys())[0]: list(colAndType.keys())[0] } outArcpySafe, outConversion = DataFrameToTable._getArcpyTypesAndConversionFromDf( colAndType) assert expectedArcpySafe == outArcpySafe assert expectedConversionDict == outConversion
def test_incorrectInputDataType(self, inputSource): with pytest.raises(TypeError): DataFrameToTable(inputSource, 'test', '')
def test_noOutputTableName(self, basicDataFrame): with pytest.raises(ValueError): DataFrameToTable(basicDataFrame, '', '')
def test_recognizeTextFileReader(self, basicTextFileReader): obj = DataFrameToTable(basicTextFileReader, 'test', '') assert obj._isIterable == True
def test_recognizedDataFrame(self, basicDataFrame): obj = DataFrameToTable(basicDataFrame, 'test', '') assert obj._isIterable == False
def test_emptyDataFrame(self, emptyDataFrame): with pytest.raises(pd.errors.EmptyDataError): DataFrameToTable(emptyDataFrame, 'test', '')