Open
Conversation
Attempt in including TH_TNIN functionality with positive and negative test cases
Closed
claesmk
requested changes
Feb 20, 2026
Contributor
claesmk
left a comment
There was a problem hiding this comment.
It is generally a bad idea to use random numbers in a test case because that can cause random / unpredictable results.
It looks like your sample valid number was not valid. I think the correct check digit is 0 so 1101700203451 should have been 1101700203450
The checksum algorithm is pretty complicated. You would need to compute it if using random numbers. You can go down that path if you want, however, I'd suggest simplifying your test case to just one valid and invalid number so that you have a positive and negative test case to meet the requirement.
The test number I provided is already publicly exposed, however, you can come up with a way to obfuscate it if you want.
Author
|
I really appreciate the help! Me and my partner were stuck for about 6
hours trying to understand where we were going wrong, because I originally
had a valid number that was scoring 1.0. Seemingly out of nowhere it
stopped working. I eventually just checked out mentally. I’ll fix the code
now using the correct positive test case along with a negative one. Thank
you!!
…On Thu, Feb 19, 2026 at 7:40 PM claesmk ***@***.***> wrote:
***@***.**** requested changes on this pull request.
It is generally a bad idea to use random numbers in a test case because
that can cause random / unpredictable results.
It looks like your sample valid number was not valid. I think the correct
check digit is 0 so 1101700203451 should have been 1101700203450
The checksum algorithm
<https://github.com/microsoft/presidio/blob/d163f10ee63bdee12548367eb3aaf11f15c35707/presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/thai/th_tnin_recognizer.py#L28>
is pretty complicated. You would need to compute it if using random
numbers. You can go down that path if you want, however, I'd suggest
simplifying your test case to just one valid and invalid number so that you
have a positive and negative test case to meet the requirement.
The test number I provided is already publicly exposed, however, you can
come up with a way to obfuscate it if you want.
—
Reply to this email directly, view it on GitHub
<#90 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BC7ZWCWONRPTT5B52XH4HXL4MZJWVAVCNFSM6AAAAACVUKYIVGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTQMRZGI2TENRWGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Attempt in including TH_TNIN functionality with positive and negative test cases