Beispiel #1
0
    def test_evaluation_dict(self):
        """Tests that the evaluation dictionary is generated correctly."""
        e = TargetEvaluator(self.submitted_targets, self.real_targets)
        d = e.evaluation_dict()

        self.assertIn('matched_target_value', d)
        self.assertIn('unmatched_target_count', d)
        self.assertIn('targets', d)
        for t in d['targets'].values():
            keys = [
                'match_value', 'image_approved', 'classifications',
                'location_accuracy', 'actionable'
            ]
            for key in keys:
                self.assertIn(key, t)
        for s in self.real_targets:
            self.assertIn(s.pk, d['targets'].keys())

        self.assertEqual(19, d['matched_target_value'])
        self.assertEqual(1, d['unmatched_target_count'])
        self.assertEqual(8, d['targets'][self.real1.pk]['match_value'])
        self.assertEqual(True, d['targets'][self.real1.pk]['image_approved'])
        self.assertEqual(1.0, d['targets'][self.real1.pk]['classifications'])
        self.assertEqual(0.0, d['targets'][self.real1.pk]['location_accuracy'])
        self.assertEqual('objective',
                         d['targets'][self.real1.pk]['actionable'])

        self.assertEqual(None, d['targets'][self.real2.pk]['actionable'])
Beispiel #2
0
    def test_evaluation_dict(self):
        """Tests that the evaluation dictionary is generated correctly."""
        e = TargetEvaluator(self.submitted_targets, self.real_targets)
        d = e.evaluation_dict()

        self.assertIn('matched_target_value', d)
        self.assertIn('unmatched_target_count', d)
        self.assertIn('targets', d)
        for t in d['targets'].values():
            keys = ['match_value', 'image_approved', 'classifications',
                    'location_accuracy', 'actionable']
            for key in keys:
                self.assertIn(key, t)
        for s in self.real_targets:
            self.assertIn(s.pk, d['targets'].keys())

        self.assertEqual(11, d['matched_target_value'])
        self.assertEqual(2, d['unmatched_target_count'])
        self.assertEqual(8, d['targets'][self.real1.pk]['match_value'])
        self.assertEqual(True, d['targets'][self.real1.pk]['image_approved'])
        self.assertEqual(1.0, d['targets'][self.real1.pk]['classifications'])
        self.assertEqual(0.0, d['targets'][self.real1.pk]['location_accuracy'])
        self.assertEqual('objective',
                         d['targets'][self.real1.pk]['actionable'])

        self.assertEqual(None, d['targets'][self.real2.pk]['actionable'])
Beispiel #3
0
    def test_evaluation_dict_no_real_targets(self):
        """Tests that evaluation_dict works with no submitted targets."""
        e = TargetEvaluator(self.submitted_targets, [])
        d = e.evaluation_dict()

        self.assertEqual(0, d['matched_target_value'])
        self.assertEqual(5, d['unmatched_target_count'])
        self.assertEqual({}, d['targets'])
Beispiel #4
0
    def test_evaluation_dict_no_real_targets(self):
        """Tests that evaluation_dict works with no submitted targets."""
        e = TargetEvaluator(self.submitted_targets, [])
        d = e.evaluation_dict()

        self.assertEqual(0, d["matched_target_value"])
        self.assertEqual(5, d["unmatched_target_count"])
        self.assertEqual({}, d["targets"])
Beispiel #5
0
    def test_evaluation_dict_no_submitted_targets(self):
        """Tests that evaluation_dict works with no submitted targets."""
        e = TargetEvaluator([], self.real_targets)
        d = e.evaluation_dict()

        self.assertEqual(0, d['matched_target_value'])
        self.assertEqual(0, d['unmatched_target_count'])
        self.assertEqual({}, d['targets'])
Beispiel #6
0
    def test_evaluation_dict_no_submitted_targets(self):
        """Tests that evaluation_dict works with no submitted targets."""
        e = TargetEvaluator([], self.real_targets)
        d = e.evaluation_dict()

        self.assertEqual(0, d['matched_target_value'])
        self.assertEqual(0, d['unmatched_target_count'])
        for td in d['targets'].values():
            for v in td.values():
                self.assertEqual('', v)
Beispiel #7
0
    def test_evaluation_dict_no_submitted_targets(self):
        """Tests that evaluation_dict works with no submitted targets."""
        e = TargetEvaluator([], self.real_targets)
        d = e.evaluation_dict()

        self.assertEqual(0, d["matched_target_value"])
        self.assertEqual(0, d["unmatched_target_count"])
        for td in d["targets"].values():
            for v in td.values():
                self.assertEqual("", v)
Beispiel #8
0
    def test_evaluation_dict(self):
        """Tests that the evaluation dictionary is generated correctly."""
        e = TargetEvaluator(self.submitted_targets, self.real_targets)
        d = e.evaluation_dict()

        self.assertIn("matched_target_value", d)
        self.assertIn("unmatched_target_count", d)
        self.assertIn("targets", d)
        for t in d["targets"].values():
            keys = ["match_value", "image_approved", "classifications", "location_accuracy", "actionable"]
            for key in keys:
                self.assertIn(key, t)
        for s in self.real_targets:
            self.assertIn(s.pk, d["targets"].keys())

        self.assertEqual(19, d["matched_target_value"])
        self.assertEqual(1, d["unmatched_target_count"])
        self.assertEqual(8, d["targets"][self.real1.pk]["match_value"])
        self.assertEqual(True, d["targets"][self.real1.pk]["image_approved"])
        self.assertEqual(1.0, d["targets"][self.real1.pk]["classifications"])
        self.assertEqual(0.0, d["targets"][self.real1.pk]["location_accuracy"])
        self.assertEqual("objective", d["targets"][self.real1.pk]["actionable"])

        self.assertEqual(None, d["targets"][self.real2.pk]["actionable"])