Skip to content

fix: remove misleading second arg from assertTrue/assertFalse calls#1381

Open
phoneee wants to merge 1 commit intoPyThaiNLP:devfrom
phoneee:fix/test-morpheme-assertions
Open

fix: remove misleading second arg from assertTrue/assertFalse calls#1381
phoneee wants to merge 1 commit intoPyThaiNLP:devfrom
phoneee:fix/test-morpheme-assertions

Conversation

@phoneee
Copy link
Copy Markdown
Contributor

@phoneee phoneee commented Mar 29, 2026

What do these changes do

Fix assertTrue(result, True) in test_morpheme — the second arg is the failure message, not the expected value

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

assertTrue(expr, True) passes True as the failure message parameter,
not as the expected value. The tests passed accidentally because
is_native_thai returns a truthy value. Remove the second argument
so assertions properly test the return value.
@sonarqubecloud
Copy link
Copy Markdown

@bact bact added this to PyThaiNLP Mar 29, 2026
@bact bact added the bug bugs in the library label Mar 29, 2026
Comment on lines 24 to 29
self.assertFalse(is_native_thai(None), False) # type: ignore[arg-type]
self.assertFalse(is_native_thai(""), False)
self.assertFalse(is_native_thai("116"), False)
self.assertFalse(is_native_thai("abc"), False)
self.assertFalse(is_native_thai("ศา"), False)
self.assertFalse(is_native_thai("ลักษ์"), False)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove the second arguments here as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug bugs in the library

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants