コード例 #1
0
    def test_compare_sections_both_pass(self):
        """Test that if all sections are in both regression and baseline
        doesn't cause a failure.

        """
        conf = {}
        comparison = Comparison('unittest', conf)
        section = 'foo_test'
        a_data = {
            section: {
                'category': comparison._tolerances.CONC,
                'min': '1.02345e-1',
                'max': '9.8765e1',
            },
            'other_section': {
                'category': comparison._tolerances.CONC,
                'min': '2.345e-2',
            },
        }
        a_name = 'a_baseline'
        b_data = {
            section: {
                'category': comparison._tolerances.CONC,
                'min': '1.02345e-1',
                'max': '9.8765e1',
            },
            'other_section': {
                'category': comparison._tolerances.CONC,
                'min': '2.345e-2',
            },
        }
        b_name = 'b_regression'
        comparison._compare_sections(a_data, a_name, b_data, b_name)
        self.assertIsNone(comparison._status)
コード例 #2
0
    def test_compare_sections_missing_current_fails(self):
        """Test that a key missing from current regression section causes a
        failure.

        """
        conf = {}
        comparison = Comparison('unittest', conf)
        section = 'foo_test'
        a_data = {
            section: {
                'category': comparison._tolerances.CONC,
                'min': '1.02345e-1',
            },
            'other_section': {},
        }
        a_name = 'a_baseline'
        b_data = {
            section: {
                'category': comparison._tolerances.CONC,
                'min': '1.02345e-1',
                'max': '9.8765e1',
            },
        }
        b_name = 'b_regression'
        comparison._compare_sections(a_data, a_name, b_data, b_name)
        self.assertEqual(comparison._status, 'fail')