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