Skip to content

Commit

Permalink
fix other xls to xlsx
Browse files Browse the repository at this point in the history
  • Loading branch information
mestachs committed Dec 18, 2024
1 parent 83ef1b6 commit ae4804c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions iaso/tests/odk/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_parse_xls_form_valid_no_settings(self):
self.assertIsInstance(survey.version, str)

def test_parse_xls_form_invalid_version(self):
with open("iaso/tests/fixtures/odk_form_invalid_version.xls", "rb") as xls_file:
with open("iaso/tests/fixtures/odk_form_invalid_version.xlsx", "rb") as xls_file:
with self.assertRaises(ParsingError) as cm:
parse_xls_form(xls_file)
self.assertEqual(str(cm.exception), "Invalid XLS file: Invalid version (must be a string of 1-10 numbers).")
Expand Down Expand Up @@ -68,7 +68,7 @@ def test_parse_xls_form_blatantly_invalid(self):
def test_parse_xls_form_autogenerate_first_version(self, now_mock):
now_mock.return_value = parse_datetime("2020-02-24T10:00:00Z")

with open("iaso/tests/fixtures/odk_form_valid_sample1_no_version.xls", "rb") as xls_file:
with open("iaso/tests/fixtures/odk_form_valid_sample1_no_version.xlsx", "rb") as xls_file:
survey = parse_xls_form(xls_file)

self.assertEqual(survey.version, "2020022401")
Expand All @@ -77,7 +77,7 @@ def test_parse_xls_form_autogenerate_first_version(self, now_mock):
def test_parse_xls_form_autogenerate_second_version_of_the_day(self, now_mock):
now_mock.return_value = parse_datetime("2020-02-24T10:00:00Z")

with open("iaso/tests/fixtures/odk_form_valid_sample1_no_version.xls", "rb") as xls_file:
with open("iaso/tests/fixtures/odk_form_valid_sample1_no_version.xlsx", "rb") as xls_file:
survey = parse_xls_form(xls_file, previous_version="2020022401")

self.assertEqual(survey.version, "2020022402")
Expand All @@ -86,7 +86,7 @@ def test_parse_xls_form_autogenerate_second_version_of_the_day(self, now_mock):
def test_parse_xls_form_autogenerate_second_version_different_day(self, now_mock):
now_mock.return_value = parse_datetime("2020-02-24T10:00:00Z")

with open("iaso/tests/fixtures/odk_form_valid_sample1_no_version.xls", "rb") as xls_file:
with open("iaso/tests/fixtures/odk_form_valid_sample1_no_version.xlsx", "rb") as xls_file:
survey = parse_xls_form(xls_file, previous_version="2020022301")

self.assertEqual(survey.version, "2020022401")
Expand All @@ -95,7 +95,7 @@ def test_parse_xls_form_autogenerate_second_version_different_day(self, now_mock
def test_parse_xls_form_autogenerate_previous_version_old_format(self, now_mock):
now_mock.return_value = parse_datetime("2020-02-24T10:00:00Z")

with open("iaso/tests/fixtures/odk_form_valid_sample1_no_version.xls", "rb") as xls_file:
with open("iaso/tests/fixtures/odk_form_valid_sample1_no_version.xlsx", "rb") as xls_file:
survey = parse_xls_form(xls_file, previous_version="1")

self.assertEqual(survey.version, "2020022401")
Expand All @@ -104,7 +104,7 @@ def test_parse_xls_form_autogenerate_previous_version_old_format(self, now_mock)
def test_parse_xls_form_autogenerate_100th_version_of_the_day(self, now_mock):
now_mock.return_value = parse_datetime("2020-02-24T10:00:00Z")

with open("iaso/tests/fixtures/odk_form_valid_sample1_no_version.xls", "rb") as xls_file:
with open("iaso/tests/fixtures/odk_form_valid_sample1_no_version.xlsx", "rb") as xls_file:
with self.assertRaises(ParsingError) as cm:
parse_xls_form(xls_file, previous_version="2020022499")
self.assertEqual(str(cm.exception), "Invalid XLS file: Too many versions.")
Expand Down
2 changes: 1 addition & 1 deletion iaso/tests/odk/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from iaso.odk import validate_xls_form


class ParsingTestCase(SimpleTestCase):
class ValidatorTestCase(SimpleTestCase):
def test_parse_xls_form_valid(self):
with open("iaso/tests/fixtures/odk_instance_repeat_group_form.xlsx", "rb") as xls_file:
errors = validate_xls_form(xls_file)
Expand Down

0 comments on commit ae4804c

Please sign in to comment.