Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

603: Always generate secondary instance for selects #614

Merged
merged 20 commits into from
Jul 31, 2023

Commits on Apr 20, 2023

  1. Configuration menu
    Copy the full SHA
    faaf52a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ae54917 View commit details
    Browse the repository at this point in the history
  3. fix: avoid output of duplicate translations, json dump, tests

    - survey.py: previous code would output position-based and
      reference-based translations (e.g. mylist-0 and choice:label), so
      it now skips reference-based translations for select_types.
    - survey_element.py: related to the above change, test_xform2json.py
      test_convert_toJSON_multi_language failed due to circular reference.
      Change traverses translations to remove offending objects.
    - pyxform_test_case.py: added the test case number to the debug/fail
      output, to help when there are many XPath expressions.
    - numerous test fixes to accommodate updated choice output.
    lindsay-stevens committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    4fa1f7d View commit details
    Browse the repository at this point in the history
  4. fix: lint

    lindsay-stevens committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    ff31a6f View commit details
    Browse the repository at this point in the history
  5. fix: remove unused xpath expressions

    - now covered by tests/xpath_helpers/choices.py
    lindsay-stevens committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    66f8838 View commit details
    Browse the repository at this point in the history

Commits on May 5, 2023

  1. fix: upgrade fixture-based test for instance_xmlns setting

    - The test was broken by changes to choices processing (XLSForm#603).
    - The test conditions seem to relate only to the instance_xmlns feature.
    - The new test asserts the same using the pyxformtestcase pattern.
    lindsay-stevens committed May 5, 2023
    Configuration menu
    Copy the full SHA
    df4e01e View commit details
    Browse the repository at this point in the history
  2. fix: formatting

    lindsay-stevens committed May 5, 2023
    Configuration menu
    Copy the full SHA
    0683836 View commit details
    Browse the repository at this point in the history
  3. fix: import error due to local name vs. package namespaced name

    - OK locally but failing on CI
    lindsay-stevens committed May 5, 2023
    Configuration menu
    Copy the full SHA
    7807e88 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f6df5b2 View commit details
    Browse the repository at this point in the history
  5. fix: xform2json choice filters support, minor codestyle improvements

    - builder.py: add type hint, remove unnecessary dict
    - xform2json.py:
      - _set_survey_name now handles multiple instances
      - _set_submission_info now sets itemset details from secondary
         instance, and attempts to parse choice filters
      - _set_translations now returns value to be set in __init__()
      - _get_text_from_translation now does media comparison as a list,
        since a dictkeysview is not a list
      - add _get_choices to include choices in internal xform representation
    - xls2json.py
      - skip adding choice lists that aren't used in the xform to avoid
        extra unnecessary data. Maybe worth a warning or maybe not.
      - add secondary instance for table-list appearance, but reject it if
        it was being added with a choice filter (not supported).
    - xform2json_test.py:
      - expand test_load_from_dump variables for easier debugging
      - add test cases for choice filters, field-list and table-list
      - these test cases can be refactored to PyxformTestCase at some stage
    - xls2xform_tests.py: use equivalent test method instead of keyword
    - update expected XML from inline choices to secondary itemset for the
      following (these can be refactored to XPath PyxformTestCase):
      - test_table_list.py
      - repeat_date_test.xml
      - xml_escaping.xml
    lindsay-stevens committed May 5, 2023
    Configuration menu
    Copy the full SHA
    1238bd6 View commit details
    Browse the repository at this point in the history
  6. add: type annotations

    - reasonably confident that these are the expected types
    lindsay-stevens committed May 5, 2023
    Configuration menu
    Copy the full SHA
    c7caf44 View commit details
    Browse the repository at this point in the history
  7. fix: import path, add base method for non-question SurveyElement

    - section should import SurveyElement from where it is defined.
    - A NotImplementedError is commonly used to indicate a base method that
      should be implemented in child classes, and it is used in
      SurveyElement for xml_control(). The Option and Tag classes don't
      seem to need this method, so adding an implementation that raises this
      error is a bit clearer.
    lindsay-stevens committed May 5, 2023
    Configuration menu
    Copy the full SHA
    e5e21f5 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    c93d0a1 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    48c6f8e View commit details
    Browse the repository at this point in the history
  10. fix: exclude select with appearance=search() from itemset, test updates

    - move choices logic off to new function add_choices_info_to_question()
      - exclude select with appearance=search() from itemset (per comment)
      - new func for readability and to clarify what info is used to
        determine choices structures
    - survey.py: skip adding translations for choices, instead of just for
      choice_filter. Use type "Option" to detect choice elements which
      should be more reliable. Move get_xpath lookup under if condition so
      it's only called if needed.
    - xls2json.py: fix lookup of select type "select one external" which
      has an alias "select_one_external". Docs use the underscore alias
      but the implementation is looking for the spaces alias.
    - xlsform_test_case/base.py: simplify reporter function
    - xlsform_spec_test.py: simplify repetitive tests by adding test func.
      Ideally these should be re-implemented as PyxformTestCase, but they
      cover a lot of scenarios so for now just simplifying the structure.
    - test_expected_output/*.xml: update expected XML to match current
      behaviour, generally: 1) update body to refer to instance, 2) add new
      instances in model, 3) add new translations in itext, 4) remove old
      itext from translations.
    - Misc minor fixes:
      - utils.py: fix deprecation warning for get_sheet_by_name.
      - replace in-line regex with pre-compiled regex, and replace match
        (only looks at start of string) with search (looks at whole string).
      - add more constants for commonly-used internal strings so that it's
        easier to find where they are used, added usages to xls2json.py.
    lindsay-stevens committed May 5, 2023
    Configuration menu
    Copy the full SHA
    42d7fd1 View commit details
    Browse the repository at this point in the history
  11. fix: minor correctness / off-by-one error in excel data processing

    - The right number of empty rows would be removed afterwards anyway, but
      for someone reading the code later it'd be better if that number was
      as stated.
    lindsay-stevens committed May 5, 2023
    Configuration menu
    Copy the full SHA
    acd7640 View commit details
    Browse the repository at this point in the history
  12. fix: tests for new itemset output for selects, add xls2json type hints

    - yes_or_no_question and xml_tests updated for new itemset output for
      selects. The default_survey_sheet test expected no default_form_name.
    - add type hints to workbook_to_json and parse_file_to_json.
    lindsay-stevens committed May 5, 2023
    Configuration menu
    Copy the full SHA
    2adb257 View commit details
    Browse the repository at this point in the history

Commits on May 11, 2023

  1. fix: translation tests failing due to itemset changes

    - test_translations.py:
      - remove xpath helpers now in xpath_helpers/choices.py
      - update test xpath assertions to match itemset behaviour
    - choices.py:
      - improve xpath helpers to not require specification of position
    lindsay-stevens committed May 11, 2023
    Configuration menu
    Copy the full SHA
    b23d704 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c2dd549 View commit details
    Browse the repository at this point in the history

Commits on May 12, 2023

  1. fix: support of or_other with selects in itemsets

    - builder.py:
      - add or_other choice to survey-level choice dict
      - add type annotations
    - constants.py: add new constant for "or specify other" internal suffix
    - xls2json.py: add error for choice_filter + or_other. Main reason I
      suppose is that it's unknown how to filter the "other" choice so the
      user might never see it.
    - xlsform_spec_test.py:
      - fix or_other expected XML to include "other" and match sorted
        element names.
      - move or_other test into this testcase since it is the same as others
        there already.
    - builder_tests.py: update expected output to match or_other output.
    lindsay-stevens committed May 12, 2023
    Configuration menu
    Copy the full SHA
    751e4ea View commit details
    Browse the repository at this point in the history