def test_other(self): it(1).should_equal(1) it(0).to_equal(0) any_of(1, 3).to_equal(1) all_of([1, 3]).should_be_int() none_of(1, 3).to_eq(0) from pyshould.expect import expect, expect_all, expect_any, expect_none expect(1).to_equal(1) # Note that matchers without params need the call parens when using this syntax expect_all(1, 3).to_be_int() expect_any([1, 3]).to_equal(1) expect(any_of(1, 3)).to_equal(1)
def test_expect(self): expect(1).to_equal(1) expect(1).to_not_equal(0)
def test_expect_quantifiers(self): expect(all_of(1, 2)).to_be_integer() expect(any_of([1, 2])).to_eq(1)
def test_ignore_keywords(self): it(1).should.be_an_int() expect(1).to.equal(1)
def it_accurately_estimates_boxes_and_keypoints_for_a_video( video_dir, expected_frames_header, expected_frames_processed): collected_progress = [] def collect_progress(state, meta): collected_progress.append((state, meta)) # we need a fake celery task to run the detect job task = __AttrDict({ "request": __AttrDict({"id": "test"}), "update_state": collect_progress }) video_dir = fixture_path(video_dir) video_path = os.path.join(video_dir, "video.mp4") video_dims = get_video_dims(video_path) result_meta = detect_boxes_and_keypoints_task(task, video_path, "anything{}") expect(result_meta).to_have_the_entry("current", 61) expect(result_meta).to_have_the_entry("total", 61) expect(result_meta).to_have_the_entry("status", "success") expect(result_meta).to_have_the_entry("result", "anythingtest") expect(result_meta).to_have_the_key("result_file") expect(result_meta["result_file"]).to_end_with("boxes_and_keypoints.npz") expect_progress_callbacks(collected_progress, expected_frames_header, expected_frames_processed) ground_truth_path = os.path.join(video_dir, "keypoints_ground_truth.npz") expected_result = np.load(ground_truth_path) result_npz = np.load(result_meta["result_file"]) result = {k: result_npz[k] for k in result_npz.files} expect_person_class_box_and_keypoint_detections_for_every_frame( expected_result, result) expect_box_detections_for_every_frame_are_5_element_arrays(result) expect_number_of_keypoints_detections_on_each_frame_matches_the_number_of_box_detections( result) expect_keypoints_detections_for_every_frame_are_4x17_ndarrays_for_17_keypoints( result) expect_keypoints_detections_for_every_frame_accurate_within_margin_of_error( expected_result, result, video_dims)