test_navdata module
Tests for NavData class.
- test_navdata.fixture_floats(df_rows)[source]
Return data corresponding to the floats label from the test data
- Parameters:
df_rows (list) – List of rows from the testing data
- Returns:
floats – Array of numeric entries in ‘floats’ label of data
- Return type:
np.ndarray
- test_navdata.fixture_flt_int_slc(df_rows)[source]
Return data corresponding to the names and strings label from the test data
- Parameters:
df_rows (list) – List of rows from the testing data
- Returns:
flt_int_slc – 2D array of some numeric entries in ‘integers’ and ‘floats’ labels of data
- Return type:
np.ndarray
- test_navdata.fixture_int_flt(df_rows)[source]
Return data corresponding to the integers and floats.
Labeled from the test data.
- Parameters:
df_rows (list) – List of rows from the testing data
- Returns:
int_flt – 2D array of numeric entries in ‘integers’ and ‘floats’ labels of data
- Return type:
np.ndarray
- test_navdata.fixture_integers(df_rows)[source]
Return data corresponding to the integers label from the test data
- Parameters:
df_rows (list) – List of rows from the testing data
- Returns:
integers – Array of numeric entries in ‘integers’ label of data
- Return type:
np.ndarray
- test_navdata.fixture_new_str_list(new_string)[source]
String to test for value assignment
- Returns:
new_string_2d – String of shape [1,6], expected value after string assignment
- Return type:
np.ndarray
- test_navdata.fixture_new_string()[source]
String to test for value assignment
- Returns:
new_string – String of length 6 to test string assignment
- Return type:
np.ndarray
- test_navdata.fixture_new_string_string_type()[source]
String to test for value assignment
- Returns:
new_string – String of length 6 to test string assignment
- Return type:
np.ndarray
- test_navdata.fixture_new_string_unicode_type()[source]
String to test for value assignment
- Returns:
new_string – String of length 6 to test string assignment
- Return type:
np.ndarray
- test_navdata.fixture_nm_str(df_rows)[source]
Return data corresponding to the names and strings label from the test data
- Parameters:
df_rows (list) – List of rows from the testing data
- Returns:
nm_str – 2D array of numeric entries in ‘names’ and ‘strings’ labels of data
- Return type:
np.ndarray
- test_navdata.fixture_str_nm(df_rows)[source]
Return data corresponding to the strings and names label from the test data
- Parameters:
df_rows (list) – List of rows from the testing data
- Returns:
str_nm – 2D array of numeric entries in ‘strings’ and ‘names’ labels of data
- Return type:
np.ndarray
- test_navdata.fixture_strings(df_rows)[source]
Return data corresponding to the strings label from the test data
- Parameters:
df_rows (list) – List of rows from the testing data
- Returns:
strings – Array of string entries in ‘strings’ label of data
- Return type:
np.ndarray
- test_navdata.fixture_subsect_str_list(subset_str)[source]
Subset string to test for value assignment
- Returns:
subset_string_2d – String of shape [1,3], expected value after string assignment
- Return type:
np.ndarray
- test_navdata.fixture_subset_str()[source]
Subset string to test for value assignment
- Returns:
subset_string – String of length 6 expected value after string assignment
- Return type:
np.ndarray
- test_navdata.return_df_rows(request)[source]
Extract and return rows from the DataFrame for testing
- Parameters:
pandas_df (pd.DataFrame) – Dataframe for testing values
- Returns:
names (np.ndarray) – String entries in ‘names’ column of the DataFrame
integers (np.ndarray) – Numeric entries in ‘integers’ column of the DataFrame
floats (np.ndarray) – Numeric entries in ‘floats’ column of the DataFrame
strings (np.ndarray) – String entries in ‘strings’ column of the DataFrame
- test_navdata.test_argwhere_nan(csv_path)[source]
Test where options on nan values.
- Parameters:
csv_path (string) – Path to csv file containing data
- test_navdata.test_col_looping(csv_simple)[source]
Testing implementation to loop over columns in NavData
- Parameters:
csv_simple (str) – path to csv file used to create NavData
- test_navdata.test_copy_navdata(data, df_simple, rows, cols)[source]
Test methods to subsets and copies of NavData instance
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – Instance of NavData
df_simple (pd.DataFrame) – Dataframe that is sliced to compare copies against
rows (list/np.ndarray) – Rows to keep in copy
cols (list/np.ndarray) – Columns to keep in copy
- test_navdata.test_dtypes_casting(csv_path)[source]
Test dtypes casting from csv back to csv
- Parameters:
csv_path (string) – Path to csv file containing data
- test_navdata.test_dtypes_changing(csv_dtypes)[source]
Test changing dtypes
- Parameters:
csv_dtypes (string) – Path to csv file containing multiple data types
- test_navdata.test_get_all_numpy(numpy_array)[source]
Test get all method using slices for NavData
- Parameters:
numpy_array (np.ndarray) – Array to initialize NavData
- test_navdata.test_get_item(data, index, exp_value)[source]
Test if assigned value is same as original value given for assignment
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – Data to test getting values from
index (slice/str/int/tuple) – Index to query data at
exp_value (np.ndarray) – Expected value at queried indices
- test_navdata.test_in_rows_multi(data)[source]
Test the in_rows function.
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – Instance of NavData
- test_navdata.test_in_rows_single(data)[source]
Test the in_rows function.
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – Instance of NavData
- test_navdata.test_init_csv(csv_path)[source]
Test initializing NavData class with csv
- Parameters:
csv_path (string) – Path to csv file containing data
- test_navdata.test_init_headless(csv_headless, df_headless)[source]
Test that headless csvs and dataframes can be loaded as expected.
- test_navdata.test_init_np(numpy_array)[source]
Test initializing NavData class with numpy array
- Parameters:
numpy_array (np.ndarray) – Numpy array containing data
- test_navdata.test_init_pd(pandas_df)[source]
Test initializing NavData class with pandas dataframe
- Parameters:
pandas_df (pd.DataFrame) – Pandas DataFrame containing data
- test_navdata.test_is_str(df_simple)[source]
Test the is_str function.
- Parameters:
df_simple (pd.DataFrame) – Simple pd.DataFrame with which to initialize NavData.
- test_navdata.test_len_rows(data)[source]
Test that len() and rows return correct output.
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – Simple version of NavData to use for test.
- test_navdata.test_multi_set(data, new_string)[source]
Test setting a numeric row with strings and vice versa.
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – NavData instance for testing
new_string (np.ndarray) – String of length 6 to test string assignment
- test_navdata.test_multi_set_changing_type(data, new_string)[source]
Test setting a numeric row with strings and vice versa.
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – NavData instance for testing
new_string (np.ndarray) – String of length 6 to test string assignment
- test_navdata.test_nan_return()[source]
Test case where NaN values in int array need to be returned.
- test_navdata.test_num_cols(data)[source]
Test that num_cols returns correct output.
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – Simple version of NavData to use for test.
- test_navdata.test_pandas_df(df_simple, df_only_header)[source]
Test that the NavData class can be printed without errors
- Parameters:
df_simple (pd.DataFrame) – Dataframe with which to construct NavData instance
df_only_header (pd.DataFrame) – Dataframe with only column names and no data
- test_navdata.test_remove_inplace(data, df_simple, rows, cols)[source]
Test method to remove rows and columns from navdata
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – Instance of NavData
df_simple (pd.DataFrame) – Dataframe that is sliced to compare copies against
rows (list/np.ndarray) – Rows to remove from NavData
cols (list/np.ndarray) – Columns to remove from NavData
- test_navdata.test_remove_navdata(data, df_simple, rows, cols)[source]
Test method to remove rows and columns from navdata
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – Instance of NavData
df_simple (pd.DataFrame) – Dataframe that is sliced to compare copies against
rows (list/np.ndarray/tuple) – Rows to remove from NavData
cols (list/np.ndarray/tuple) – Columns to remove from NavData
- test_navdata.test_rename_fails(df_simple, df_only_header)[source]
Test column renaming functionality.
- Parameters:
df_simple (pd.DataFrame) – pd.DataFrame to initialize NavData with.
df_only_header (pd.DataFrame) – Dataframe with only column names and no data
- test_navdata.test_rename_inplace(pandas_df)[source]
Test column renaming functionality.
- Parameters:
pandas_df (pd.DataFrame) – Dataframe for testing values
- test_navdata.test_rename_mapper_and_rows(df_simple)[source]
Test data renaming functionality with type changes and row names.
- Parameters:
df_simple (pd.DataFrame) – pd.DataFrame to initialize NavData with
- test_navdata.test_rename_new_navdata(pandas_df)[source]
Test column renaming functionality.
- Parameters:
pandas_df (pd.DataFrame) – Dataframe for testing values
- test_navdata.test_replace_fails(df_simple, df_only_header)[source]
Test replace renaming functionality.
- Parameters:
df_simple (pd.DataFrame) – pd.DataFrame to initialize NavData with.
df_only_header (pd.DataFrame) – Dataframe with only column names and no data
- test_navdata.test_replace_mapper_all(df_simple, rows)[source]
Test data renaming functionality.
- Parameters:
df_simple (pd.DataFrame) – pd.DataFrame to initialize NavData with.
rows (None or array-like) – Rows for which mapper is implemented.
- test_navdata.test_replace_mapper_partial(df_simple, rows)[source]
Test data renaming functionality.
- Parameters:
df_simple (pd.DataFrame) – pd.DataFrame to initialize NavData with.
rows (array-like) – Rows for which mapper is implemented.
- test_navdata.test_replace_mapper_type_change(df_simple)[source]
Test data renaming functionality with type changes.
- Parameters:
df_simple (pd.DataFrame) – pd.DataFrame to initialize NavData with
- test_navdata.test_set_changing_type(data, new_string)[source]
Test setting a numeric row with strings and vice versa.
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – NavData instance for testing
new_string (np.ndarray) – String of length 6 to test string assignment
- test_navdata.test_set_get_item(data, index, new_value, exp_value)[source]
Test if assigned values match expected values on getting again
- Parameters:
data (gnss_lib_py.navdata.navdata.NavData) – NavData instance for testing
index (slice/str/int/tuple) – Index to query data at
new_value (np.ndarray/int) – Value to assign at query index
exp_value (np.ndarray) – Expected value at queried indices
- test_navdata.test_str_navdata(df_simple, df_only_header)[source]
Test that the NavData class can be printed without errors
- Parameters:
df_simple (pd.DataFrame) – Dataframe with which to construct NavData instance
df_only_header (pd.DataFrame) – Dataframe with only column names and no data
- test_navdata.test_where_empty(df_simple)[source]
Verify empty slices.
- Parameters:
df_simple (pd.DataFrame) – Simple pd.DataFrame with which to initialize NavData.
- test_navdata.test_where_errors(csv_simple)[source]
Testing error cases for NavData.where
- Parameters:
csv_simple (str) – Path to csv file used to create NavData
- test_navdata.test_where_numbers(csv_simple)[source]
Testing implementation of NavData.where for numeric values
- Parameters:
csv_simple (str) – Path to csv file used to create NavData