Skip to content

Commit

Permalink
Merge pull request #320 from kobotoolbox/fix-deprecation-warnings
Browse files Browse the repository at this point in the history
Fix deprecation warnings
  • Loading branch information
jnm authored Apr 30, 2024
2 parents 3b6c89a + 768ee67 commit d53b10c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/formpack/utils/expand_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def _mark_special(**kwargs: str) -> None:
def _expand_type_to_dict(type_str: str) -> Dict[str, Union[str, bool]]:
SELECT_PATTERN = r'^({select_type})\s+(\S+)$'
out = {}
match = re.search('\s+(or.other)$', type_str)
match = re.search(r'\s+(or.other)$', type_str)
if match:
type_str = type_str.replace(match.groups()[0], '').strip()
out[OR_OTHER_COLUMN] = True
Expand Down
16 changes: 8 additions & 8 deletions tests/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def test_simple_nested_grouped_repeatable(self):
with TempDir() as d:
xls = d / 'foo.xlsx'
export.to_xlsx(xls, submissions)
assert xls.isfile()
assert xls.is_file()

def test_repeats(self):
title, schemas, submissions = build_fixture('grouped_repeatable')
Expand Down Expand Up @@ -1889,7 +1889,7 @@ def test_xlsx(self):
with TempDir() as d:
xls = d / 'foo.xlsx'
fp.export(**options).to_xlsx(xls, submissions)
assert xls.isfile()
assert xls.is_file()

def test_xlsx_with_types(self):
title, schemas, submissions = build_fixture('nested_grouped_repeatable')
Expand All @@ -1899,7 +1899,7 @@ def test_xlsx_with_types(self):
with TempDir() as d:
xls = d / 'foo.xlsx'
fp.export(**options).to_xlsx(xls, submissions)
assert xls.isfile()
assert xls.is_file()

def test_xlsx_long_sheet_names_and_invalid_chars(self):
title, schemas, submissions = build_fixture('long_names')
Expand All @@ -1912,7 +1912,7 @@ def test_xlsx_long_sheet_names_and_invalid_chars(self):
with TempDir() as d:
xls = d / 'foo.xlsx'
fp.export(**options).to_xlsx(xls, submissions)
assert xls.isfile()
assert xls.is_file()
book = openpyxl.load_workbook(xls)
assert book.sheetnames == [
'long survey name_ the quick,...',
Expand Down Expand Up @@ -1943,7 +1943,7 @@ def test_xlsx_too_long_string(self):
with TempDir() as d:
xls = d / 'foo.xlsx'
fp.export().to_xlsx(xls, submissions)
assert xls.isfile()
assert xls.is_file()
book = openpyxl.load_workbook(xls)
sheet = book[title]
row_values = [cell.value for cell in sheet[2]]
Expand Down Expand Up @@ -1974,7 +1974,7 @@ def test_xlsx_too_long_url(self):
with TempDir() as d:
xls = d / 'foo.xlsx'
fp.export().to_xlsx(xls, submissions)
assert xls.isfile()
assert xls.is_file()
book = openpyxl.load_workbook(xls)
sheet = book[title]
row_values = [cell.value for cell in sheet[2]]
Expand Down Expand Up @@ -2018,7 +2018,7 @@ def test_xlsx_with_tag_headers(self):
with TempDir() as d:
xls = d / 'foo.xlsx'
fp.export(**options).to_xlsx(xls, submissions)
assert xls.isfile()
assert xls.is_file()
book = openpyxl.load_workbook(xls, data_only=True)
# Verify main sheet
sheet = book['Household survey with HXL an...']
Expand Down Expand Up @@ -2159,7 +2159,7 @@ def test_copy_fields_and_force_index_and_unicode(self):
with TempDir() as d:
xls = d / 'test.xlsx'
fp.export().to_xlsx(xls, submissions)
assert xls.isfile()
assert xls.is_file()

def test_copy_fields_multiple_versions(self):
title, schemas, submissions = restaurant_profile
Expand Down

0 comments on commit d53b10c

Please sign in to comment.