Skip to content

Add edge case tests for empty/None/zero/negative inputs#1220

Merged
bact merged 4 commits intodevfrom
copilot/add-tests-for-output-coverage
Jan 21, 2026
Merged

Add edge case tests for empty/None/zero/negative inputs#1220
bact merged 4 commits intodevfrom
copilot/add-tests-for-output-coverage

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

What does this changes

Adds 40 edge case test assertions across core, compact, and extra test suites. Tests now validate behavior for empty collections, None values, zero, negative numbers, and boundary conditions.

Core tests (test_util.py):

  • collate(): empty list, single item, reverse parameter
  • rank(): empty input, all stopwords, exclude_stopwords variations
  • find_keyword(): empty list, min_len boundaries (0, 1, 10)
  • bahttext(): negative values, large numbers, float precision
  • thai_keyboard_dist(): identical chars, None inputs

Compact tests (testc_util.py, testc_tools.py):

  • spell_word(): None and empty string
  • misspell(): empty string, single char, None handling

Extra tests (testx_util.py, testx_classify.py):

  • thai_word_tone_detector(): None and empty string
  • GzipModel.predict(): empty input, k parameter variations

What was wrong

Test coverage lacked validation for edge cases: empty collections, None values, zero, negative numbers, and parameter boundaries.

How this fixes it

Documents actual function behavior at boundaries. Tests verify functions handle edge cases correctly or raise appropriate exceptions (TypeError, ValueError, AttributeError).

Your checklist for this pull request

  • Passed code styles and structures
  • Passed code linting checks and unit test
Original prompt

Gradually add test to increase cover coverage. Focus on tests that check different types of output, including empty collection/iterable, zero, negative, None, as appropriate.

Start first with test (core), testc (compact), then expand to testx (extra)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 21, 2026 17:04
…bahttext, thai_keyboard_dist)

Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
Co-authored-by: bact <128572+bact@users.noreply.github.com>
@sonarqubecloud
Copy link

@bact bact added the tests Unit test, code coverage, test case label Jan 21, 2026
@bact bact marked this pull request as ready for review January 21, 2026 17:14
Copilot AI changed the title [WIP] Add tests to increase coverage for different output types Add edge case tests for empty/None/zero/negative inputs Jan 21, 2026
Copilot AI requested a review from bact January 21, 2026 17:15
@bact bact merged commit b4e9173 into dev Jan 21, 2026
44 checks passed
@bact bact deleted the copilot/add-tests-for-output-coverage branch January 21, 2026 17:31
@bact bact added this to the 5.3 milestone Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Unit test, code coverage, test case

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants