Skip to main content

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 quoteTestEveryReturnedSpanReproducesItsQuote. ── #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 modelsTestTheStoredQuoteIsTheMessagesTextNotTheModels. The stored quote is the message's text, not the model's.
  • A span is correct in bytes when the text is not ASCIITestASpanIsCorrectInBytesWhenTheTextIsNotASCII. A span must be correct in bytes, not in characters.
  • A message with nothing assertable is an empty resultTestAMessageWithNothingAssertableIsAnEmptyResult. A message that asserts nothing produces an empty result, not an error.
  • A model failure is an errorTestAModelFailureIsAnError. A model failure IS an error.
  • The vocabulary types the object when the model did notTestTheVocabularyTypesTheObjectWhenTheModelDidNot. The vocabulary types the object end when the model volunteered nothing.
  • A quote that changed case is refusedTestAQuoteThatChangedCaseIsRefused. Case is not whitespace.
  • A relation asserted twice in one message is one claimTestARelationAssertedTwiceInOneMessageIsOneClaim. ── #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 useTestARepeatIsFoundThroughTheSameNormalisationEntitiesUse. Identity is what identity is downstream.
  • Different relations and different ends are not repeatsTestDifferentRelationsAndDifferentEndsAreNotRepeats. 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 uncitableTestARepeatWithAnInventedQuoteIsRefusedAsUncitable. A repeat whose quote cannot be found is uncitable, which is the more specific defect.
  • A claim the message did not assert is refusedTestAClaimTheMessageDidNotAssertIsRefused. ── #73: a claim the message did not assert ─────────────────────────────────────────────────── Measured against a live model: I do not live in London. produced lives_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 assumedTestAnAbsentOrUnrecognisedPolarityIsRefusedRatherThanAssumed. 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 repeatingTestAnUnassertedRepeatIsRefusedForNotBeingAssertedRatherThanForRepeating. The polarity check runs before the duplicate check, so the row carries the reason that is true.
  • An asserted claim still becomes a factTestAnAssertedClaimStillBecomesAFact. 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 refusedTestASubjectThatNamesNothingIsRefused
  • A pronoun subject is refused for naming nothing rather than for its quoteTestAPronounSubjectIsRefusedForNamingNothingRatherThanForItsQuote. 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 refusedTestARealSubjectIsNotRefused. A real subject is untouched, which is the property a conservative filter is most likely to break.
  • An extractor with no term set still worksTestAnExtractorWithNoTermSetStillWorks. 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 currentTestARelationThePastHoldsIsRefusedRatherThanStoredAsCurrent. ── #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 assumedTestAnAbsentOrUnrecognisedTenseIsRefusedRatherThanAssumed. A tense the model did not give, or gave a value nobody recognises, is refused.
  • A denied past tense is refused for the denialTestADeniedPastTenseIsRefusedForTheDenial. 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 factTestARelationThatBeganInThePastAndStillHoldsIsAFact. 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 notTestAPastTenseEventIsAFactWhileAPastTenseStateIsNot. 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