예제 #1
0
파일: ecobenefits.py 프로젝트: PyBulls/OTM2
 def test_group_basis_combine_new_group(self):
     # New groups are added
     basis = {
         'group1': {
             'n_objects_used': 5,
             'n_objects_discarded': 8
         }
     }
     new_group = {
         'group2': {
             'n_objects_used': 13,
             'n_objects_discarded': 4
         }
     }
     target = {
         'group1': {
             'n_objects_used': 5,
             'n_objects_discarded': 8
         },
         'group2': {
             'n_objects_used': 13,
             'n_objects_discarded': 4
         }
     }
     _combine_benefit_basis(basis, new_group)
     self.assertEqual(basis, target)
예제 #2
0
 def test_group_basis_combine_existing_groups(self):
     basis = {'group1': {'n_objects_used': 5, 'n_objects_discarded': 8}}
     update_group = {
         'group1': {
             'n_objects_used': 13,
             'n_objects_discarded': 4
         }
     }
     target = {'group1': {'n_objects_used': 18, 'n_objects_discarded': 12}}
     _combine_benefit_basis(basis, update_group)
     self.assertEqual(basis, target)
예제 #3
0
    def test_group_basis_empty(self):
        basis = {}
        example = {
            'group1': {
                'n_objects_used': 5,
                'n_objects_discarded': 8
            },
            'group2': {
                'n_objects_used': 10,
                'n_objects_discarded': 12
            }
        }

        _combine_benefit_basis(basis, example)
        self.assertEqual(basis, example)
예제 #4
0
파일: ecobenefits.py 프로젝트: PyBulls/OTM2
    def test_group_basis_empty(self):
        basis = {}
        example = {
            'group1': {
                'n_objects_used': 5,
                'n_objects_discarded': 8
            },
            'group2': {
                'n_objects_used': 10,
                'n_objects_discarded': 12
            }
        }

        _combine_benefit_basis(basis, example)
        self.assertEqual(basis, example)
예제 #5
0
 def test_group_basis_combine_new_group(self):
     # New groups are added
     basis = {'group1': {'n_objects_used': 5, 'n_objects_discarded': 8}}
     new_group = {
         'group2': {
             'n_objects_used': 13,
             'n_objects_discarded': 4
         }
     }
     target = {
         'group1': {
             'n_objects_used': 5,
             'n_objects_discarded': 8
         },
         'group2': {
             'n_objects_used': 13,
             'n_objects_discarded': 4
         }
     }
     _combine_benefit_basis(basis, new_group)
     self.assertEqual(basis, target)
예제 #6
0
파일: ecobenefits.py 프로젝트: PyBulls/OTM2
 def test_group_basis_combine_existing_groups(self):
     basis = {
         'group1': {
             'n_objects_used': 5,
             'n_objects_discarded': 8
         }
     }
     update_group = {
         'group1': {
             'n_objects_used': 13,
             'n_objects_discarded': 4
         }
     }
     target = {
         'group1': {
             'n_objects_used': 18,
             'n_objects_discarded': 12
         }
     }
     _combine_benefit_basis(basis, update_group)
     self.assertEqual(basis, target)