# Path: dcs/load.py
# def guessEncoding(filename):
# def convertEncoding(filename, source="utf-8", destination="utf-8", buffer=1024):
# def CSVtoDataFrame(filename, header=0, initialSkip=0, sampleSize=100, seed=None, headerIncluded=True):
# def JSONtoDataFrame(filename, sampleSize=100, seed=None):
# def XLSXtoDataFrame(filename, initialSkip=0, sampleSize=100, seed=None, headerIncluded=True):
# def dataFrameToJSON(df, rowIndexFrom=None, rowIndexTo=None, columnIndexFrom=None, columnIndexTo=None):
# def renameColumn(df, column, newName):
# def emptyStringToNan(df, columnIndex):
# def newCellValue(df, columnIndex, rowIndex, newValue):
# def removeRows(df, rowIndices):
# def removeColumns(df, columnIndices):
# def rowsWithInvalidValuesInColumns(df, columnIndices):
# def duplicateRowsInColumns(df, columnIndices):
# def outliersTrimmedMeanSd(df, columnIndices, r=2, k=0):
# def changeColumnDataType(df, column, newDataType, dateFormat=None): 


import numpy as np
import pandas as pd
import pytest
import datetime
from dcs import load
def test_changeCellCalue3():
	testing_df = df.copy()
	result_df =df.copy()
	load.newCellValue(testing_df, 16, 16, 'hello')
	assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True

#----------------(return rows containing invalid values in a column)----------------

#retunrn rows containing ivalid values in a column
def test_invalidRows1():
	testing_df = df.copy()
	result_df = df.copy()
	return_df = load.rowsWithInvalidValuesInColumns(testing_df, [0])
	result_df.drop(result_df.index[0], inplace=True)
	assert (((return_df.fillna(0) == result_df.fillna(0)).all()).all()) == True

#retunrn rows containing ivalid values in multiple columns
def test_invalidRows2():
	testing_df = df.copy()
	testing_df['col3'] = pd.Series(['1'], index = [0])
	result_df = testing_df.copy()
	return_df = load.rowsWithInvalidValuesInColumns(testing_df, [0, 2])
	result_df.drop(result_df.index[0], inplace=True)
	assert (((return_df.fillna(0) == result_df.fillna(0)).all()).all()) == True

#return rows containing invalid values in every column (should return an empty dataframe)
def test_invalidRows3():
	testing_df = df.copy()
	testing_df['col3'] = pd.Series(['1'], index = [1])
	result_df = testing_df.copy()

# Path: dcs/load.py
# def guessEncoding(filename):
# def convertEncoding(filename, source="utf-8", destination="utf-8", buffer=1024):
# def CSVtoDataFrame(filename, header=0, initialSkip=0, sampleSize=100, seed=None, headerIncluded=True):
# def JSONtoDataFrame(filename, sampleSize=100, seed=None):
# def XLSXtoDataFrame(filename, initialSkip=0, sampleSize=100, seed=None, headerIncluded=True):
# def dataFrameToJSON(df, rowIndexFrom=None, rowIndexTo=None, columnIndexFrom=None, columnIndexTo=None):
# def renameColumn(df, column, newName):
# def emptyStringToNan(df, columnIndex):
# def newCellValue(df, columnIndex, rowIndex, newValue):
# def removeRows(df, rowIndices):
# def removeColumns(df, columnIndices):
# def rowsWithInvalidValuesInColumns(df, columnIndices):
# def duplicateRowsInColumns(df, columnIndices):
# def outliersTrimmedMeanSd(df, columnIndices, r=2, k=0):
# def changeColumnDataType(df, column, newDataType, dateFormat=None): 


# Path: dcs/testing/test_load_module.py
import numpy as np
import pandas as pd
import pytest
import datetime
from dcs import load

def test_changeCellCalue3():
	testing_df = df.copy()
	result_df =df.copy()
	load.newCellValue(testing_df, 16, 16, 'hello')
	assert (((testing_df.fillna(0) == result_df.fillna(0)).all()).all()) == True

#----------------(return rows containing invalid values in a column)----------------

#retunrn rows containing ivalid values in a column
def test_invalidRows1():
	testing_df = df.copy()
	result_df = df.copy()
	return_df = load.rowsWithInvalidValuesInColumns(testing_df, [0])
	result_df.drop(result_df.index[0], inplace=True)
	assert (((return_df.fillna(0) == result_df.fillna(0)).all()).all()) == True

#retunrn rows containing ivalid values in multiple columns
def test_invalidRows2():
	testing_df = df.copy()
	testing_df['col3'] = pd.Series(['1'], index = [0])
	result_df = testing_df.copy()
	return_df = load.rowsWithInvalidValuesInColumns(testing_df, [0, 2])
	result_df.drop(result_df.index[0], inplace=True)
	assert (((return_df.fillna(0) == result_df.fillna(0)).all()).all()) == True

#return rows containing invalid values in every column (should return an empty dataframe)
def test_invalidRows3():
	testing_df = df.copy()
	testing_df['col3'] = pd.Series(['1'], index = [1])
	result_df = testing_df.copy()

	return_df = load.rowsWithInvalidValuesInColumns(testing_df, [0, 1, 2])