Tests: internal/extract
internal/extract · 25 tests
Each test is named for the property it holds, and runs against a real deployment: there is no mock of the database and no arm that skips when it is absent. The sentence is the test's name read back; the name is what go test -run takes.
extract_test.go
- Every returned span reproduces its quote —
TestEveryReturnedSpanReproducesItsQuote. ── #42's claim ─────────────────────────────────────────────────────────────────────────────── Every returned claim's span, taken from the message content, equals its quote. - The stored quote is the messages text not the models —
TestTheStoredQuoteIsTheMessagesTextNotTheModels. The stored quote is the message's text, not the model's. - A span is correct in bytes when the text is not ASCII —
TestASpanIsCorrectInBytesWhenTheTextIsNotASCII. A span must be correct in bytes, not in characters. - A message with nothing assertable is an empty result —
TestAMessageWithNothingAssertableIsAnEmptyResult. A message that asserts nothing produces an empty result, not an error. - A model failure is an error —
TestAModelFailureIsAnError. A model failure IS an error. - The vocabulary types the object when the model did not —
TestTheVocabularyTypesTheObjectWhenTheModelDidNot. The vocabulary types the object end when the model volunteered nothing. - A quote that changed case is refused —
TestAQuoteThatChangedCaseIsRefused. Case is not whitespace. - A relation asserted twice in one message is one claim —
TestARelationAssertedTwiceInOneMessageIsOneClaim. ── #74 ─────────────────────────────────────────────────────────────────────────────────────── One message asserting the same relation twice is one fact, and the repeat is recorded rather than dropped. - A repeat is found through the same normalisation entities use —
TestARepeatIsFoundThroughTheSameNormalisationEntitiesUse. Identity is what identity is downstream. - Different relations and different ends are not repeats —
TestDifferentRelationsAndDifferentEndsAreNotRepeats. Two relations sharing a subject are not a repeat, and neither are two objects under one relation. - A repeat with an invented quote is refused as uncitable —
TestARepeatWithAnInventedQuoteIsRefusedAsUncitable. A repeat whose quote cannot be found is uncitable, which is the more specific defect. - A claim the message did not assert is refused —
TestAClaimTheMessageDidNotAssertIsRefused. ── #73: a claim the message did not assert ─────────────────────────────────────────────────── Measured against a live model:I do not live in London.producedlives_in(I, London)on some attempts, with a quote that verified exactly — because the words really are in the message. - An absent or unrecognised polarity is refused rather than assumed —
TestAnAbsentOrUnrecognisedPolarityIsRefusedRatherThanAssumed. A polarity the model did not give, or gave a value nobody recognises, is refused. - An unasserted repeat is refused for not being asserted rather than for repeating —
TestAnUnassertedRepeatIsRefusedForNotBeingAssertedRatherThanForRepeating. The polarity check runs before the duplicate check, so the row carries the reason that is true. - An asserted claim still becomes a fact —
TestAnAssertedClaimStillBecomesAFact. An asserted claim still becomes a fact, which is the property a conservative fix is most likely to break. - A subject that names nothing is refused —
TestASubjectThatNamesNothingIsRefused - A pronoun subject is refused for naming nothing rather than for its quote —
TestAPronounSubjectIsRefusedForNamingNothingRatherThanForItsQuote. It is refused for naming nothing rather than for anything else, so the refusal counts stay meaningful — a pronoun subject recorded as an uncitable quote would send whoever reads the refusals looking at the model's quoting when the problem is elsewhere. - A real subject is not refused —
TestARealSubjectIsNotRefused. A real subject is untouched, which is the property a conservative filter is most likely to break. - An extractor with no term set still works —
TestAnExtractorWithNoTermSetStillWorks. An extractor built without the term set behaves as it did before, rather than refusing everything or nothing unpredictably. - A relation the past holds is refused rather than stored as current —
TestARelationThePastHoldsIsRefusedRatherThanStoredAsCurrent. ── #100: a relation the message puts in the past ───────────────────────────────────────────── "I used to live in Amman." asserts the relation — positively, not hedged, not reported — so every check before this one passes and the fact that lands says the person lives there now. - An absent or unrecognised tense is refused rather than assumed —
TestAnAbsentOrUnrecognisedTenseIsRefusedRatherThanAssumed. A tense the model did not give, or gave a value nobody recognises, is refused. - A denied past tense is refused for the denial —
TestADeniedPastTenseIsRefusedForTheDenial. The tense check runs after polarity, so a denial about the past is recorded as the denial it is. - A relation that began in the past and still holds is a fact —
TestARelationThatBeganInThePastAndStillHoldsIsAFact. And a relation that began in the past and holds now is present, so the gate costs nothing here. - A past tense event is a fact while a past tense state is not —
TestAPastTenseEventIsAFactWhileAPastTenseStateIsNot. A completed event is reported in the past tense and stays true, so an event relation's past tense is a fact; its future tense is still not, and a state relation's past tense is still refused.
identity_test.go
- Extraction fingerprint includes ordered vocabulary and admission but not set order —
TestExtractionFingerprintIncludesOrderedVocabularyAndAdmissionButNotSetOrder