Repository navigation
BUG: Expect a Human Confidence source only from a key that carries it, and accept the level Unknown - #258
Merged
Conversation
…sserts on its value Three tests of a helper the example tests do not have yet, key_carries, which reads the cloud's list of the properties a resource key carries. They fail on import until it exists.
…, and accept the level Unknown The live test of the Human Confidence web example expected the source Passive from any key that carries HumanConfidence. HumanConfidenceSource is a property of its own, and the example gives no source for a key without it, so the test failed with such a key. The test now asks the cloud whether the key carries HumanConfidenceSource, and expects Passive when it does and no source when it does not. It also expected the level to be High, Medium or Low. The property has a fourth value, Unknown, which the cloud gives when it has too little to rate the request, so the test accepts it.
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.
Problem
The live test of the Human Confidence web example fails on every configuration of a full build of
rc.Run 45003685744 built
rcat 707883c with BUG: Refuse writes through a view of a finished Flow Data's Element Data #256 and BUG: Require fiftyone_pipeline_core at the version that holds the names four packages import #257, on Ubuntu, Windows and macOS. In each of the 13 jobs that had finished when it was read,tests/test_cloud_humanconfidence_web.py::test_passive_level_comes_from_the_cloudfailed. For example job Ubuntu_Python_3.12:The test came with #255, which merged on 22 November. No build before this one reached it, because every build of
rcstopped earlier, in Configure or in the Pipeline's unit tests.Cause
There are two faults in the one test, and the first hid the second.
humanconfidencesourcein the cloud's answer (app.pyline 208), and givesNonewhen the answer has none.HumanConfidenceSourceis a property of its own. Before it runs, the test checks only that the key carriesHumanConfidence(carries_human_confidence, lines 125 to 145). The cloud leaves out a property a key does not carry. The key the tests ran with here carriesHumanConfidenceand notHumanConfidenceSource, and gives the failure the builds show. The builds' own key can't be read back, so that it lacks the property is taken from the same failure and not seen directly. The example's own offline test,test_passive_without_the_properties_returns_neither, already expectsNonefor that case.High,MediumorLow. The property has a fourth value,Unknown, which the cloud gives when it has too little to rate the request. With the first fault out of the way, the same test failed here withAssertionError: assert 'Unknown' in ('High', 'Medium', 'Low').What changed
Tests only. The example is unchanged.
tests/helpers.pyhas a new helper,key_carries(api, resource_key, name), which asks the cloud'saccessiblepropertiesfor the properties the key carries and says whether the named one is among them, whatever its case. A status other than 200 raises, with the cloud's text.test_passive_level_comes_from_the_cloudexpects the source to bePassivewhen the key carriesHumanConfidenceSource, andNonewhen it does not.High,Medium,LowandUnknown.tests/test_cloud_humanconfidence_web_offline.pyhas three new tests of the helper, against the stand-in for the cloud that file already has: a property the cloud lists, one it leaves out, and a key the cloud refuses.How it was verified
Windows, Python 3.12.10, pytest, in
pipeline/fiftyone_pipeline_cloudrequestengine/examples, with a resource key that lists 371 properties,HumanConfidenceamong them andHumanConfidenceSourcenot.rc3abc17etests/test_cloud_humanconfidence_web.py: 1 failed,assert None == 'Passive', the failure the runners showtests/test_cloud_humanconfidence_web_offline.pydoes not import:ImportError: cannot import name 'key_carries' from 'helpers'AssertionError: assert 'Unknown' in ('High', 'Medium', 'Low')pytest tests: 111 passed, 1 skipped, 0 failedHumanConfidenceSource, as none was to hand. That branch is the assertion the test had before. Linux and macOS were not run here either.What remains
Passive, a key that carriesHumanConfidenceSourcehas to be given to them. That is a choice about the keys, not about this test.test_onpremise_datafileupdate_consoleasks the Distributor for the Enterprise device detection file, which the data license the builds now use does not include.