Skip to content

Commit

Permalink
resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgreen-moj committed Dec 28, 2023
2 parents 8623f8e + 4d84079 commit 7cc2249
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import csv
from geocode import geocode, find_timezone, find_country_code


def clean_csv_rows_by_removing_nbsp(unformatted_csv_rows):
cleaned_rows = []

Expand All @@ -25,6 +26,8 @@ def clean_csv_rows_by_removing_nbsp(unformatted_csv_rows):
return cleaned_rows

# Convert CSV file to JSON object.


def convert_csv_to_json(file_path):
csv_rows = []
with open(file_path) as csvfile:
Expand Down Expand Up @@ -66,7 +69,8 @@ def add_geocoding_to_json(data):
# Convert CSV to valid JSON
json_data_without_geocoding = convert_csv_to_json(csv_file_path)

clean_json_data_without_geocoding = clean_csv_rows_by_removing_nbsp(json_data_without_geocoding)
clean_json_data_without_geocoding = clean_csv_rows_by_removing_nbsp(
json_data_without_geocoding)

json_data_with_geocoding = add_geocoding_to_json(
clean_json_data_without_geocoding)
Expand Down
6 changes: 4 additions & 2 deletions test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ def test_clean_csv_rows_no_nbsp(self):
'Enable MoJWifi': ' "FALSE"', 'GovWifi Radius Key': '0D0E0DDE000BC0EEE000', 'Wired NACS Radius Key': '00000DD0000BC0EEE000'}
]
output_data = clean_csv_rows_by_removing_nbsp(input_data)
self.assertEqual(output_data, input_data, "No non-breaking spaces, should be unchanged")
self.assertEqual(output_data, input_data,
"No non-breaking spaces, should be unchanged")

def test_keys_clean_csv_rows_with_nbsp(self):
input_data = [
Expand All @@ -136,7 +137,8 @@ def test_keys_clean_csv_rows_with_nbsp(self):
'Site Name': 'non breaking space test',
'Wired NACS Radius Key': '00000DD0000BC0EEE000'}]
output_data = clean_csv_rows_by_removing_nbsp(input_data)
self.assertEqual(output_data, expected_output, "Non-breaking spaces should be removed")
self.assertEqual(output_data, expected_output,
"Non-breaking spaces should be removed")

def test_values_clean_csv_rows_with_nbsp(self):
input_data = [
Expand Down

0 comments on commit 7cc2249

Please sign in to comment.