Beispiel #1
0
 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
Beispiel #2
0
    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
Beispiel #3
0
    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
Beispiel #4
0
 def test_incorrectInputDataType(self, inputSource):
     with pytest.raises(TypeError):
         DataFrameToTable(inputSource, 'test', '')
Beispiel #5
0
 def test_noOutputTableName(self, basicDataFrame):
     with pytest.raises(ValueError):
         DataFrameToTable(basicDataFrame, '', '')
Beispiel #6
0
 def test_recognizeTextFileReader(self, basicTextFileReader):
     obj = DataFrameToTable(basicTextFileReader, 'test', '')
     assert obj._isIterable == True
Beispiel #7
0
 def test_recognizedDataFrame(self, basicDataFrame):
     obj = DataFrameToTable(basicDataFrame, 'test', '')
     assert obj._isIterable == False
Beispiel #8
0
 def test_emptyDataFrame(self, emptyDataFrame):
     with pytest.raises(pd.errors.EmptyDataError):
         DataFrameToTable(emptyDataFrame, 'test', '')