Beispiel #1
0
 def test_two_equal_size_fuelbeds(self):
     g = {
         "fuelbeds": [{
             "fccs_id": "46",
             "pct": 100.0
         }, {
             "fccs_id": "44",
             "pct": 100.0
         }]
     }
     assert "46" == firescsvs._pick_representative_fuelbed({}, g)
Beispiel #2
0
 def test_three_fuelbed(self):
     g = {
         "fuelbeds": [{
             "fccs_id": "46",
             "pct": 10.0
         }, {
             "fccs_id": "47",
             "pct": 60.0
         }, {
             "fccs_id": "48",
             "pct": 30.0
         }]
     }
     assert "47" == firescsvs._pick_representative_fuelbed({}, g)
Beispiel #3
0
    def test_invalid_fuelbed(self):
        g = {"fuelbeds": 'sdf'}
        with raises(TypeError) as e_info:
            firescsvs._pick_representative_fuelbed({}, g)
        # TODO: assert e_info.value.args[0] == '...''

        g = {"fuelbeds": [{"sdf_fccs_id": "46", "pct": 100.0}]}
        with raises(KeyError) as e_info:
            firescsvs._pick_representative_fuelbed({}, g)
        # TODO: assert e_info.value.args[0] == '...''
        g = {"fuelbeds": [{"fccs_id": "46", "sdfsdfpct": 100.0}]}
        with raises(KeyError) as e_info:
            firescsvs._pick_representative_fuelbed({}, g)
Beispiel #4
0
 def test_one_fuelbed(self):
     g = {"fuelbeds": [{"fccs_id": "46", "pct": 100.0}]}
     assert "46" == firescsvs._pick_representative_fuelbed({}, g)
Beispiel #5
0
 def test_no_fuelbeds(self):
     g = {}
     assert None == firescsvs._pick_representative_fuelbed({}, g)
     g = {"activity": []}
     assert None == firescsvs._pick_representative_fuelbed({}, g)
Beispiel #6
0
 def test_two_fuelbeds_one_with_no_pct(self):
     g = {"fuelbeds": [{"fccs_id": "46"}, {"fccs_id": "44", "pct": 100.0}]}
     assert "44" == firescsvs._pick_representative_fuelbed({}, g)
Beispiel #7
0
 def test_one_fuelbed_no_pct(self):
     g = {"fuelbeds": [{"fccs_id": "46"}]}
     assert "46" == firescsvs._pick_representative_fuelbed({}, g)
Beispiel #8
0
    def test_one_fuelbed_no_fccs_id(self):
        g = {"fuelbeds": [{"pct": 100.0}]}
        assert None == firescsvs._pick_representative_fuelbed({}, g)

        g["fuelbeds"][0]["sdf_fccs_id"] = "46"
        assert None == firescsvs._pick_representative_fuelbed({}, g)
Beispiel #9
0
 def test_invalid_fuelbed(self):
     g = {"fuelbeds": 'sdf'}
     with raises(AttributeError) as e_info:
         firescsvs._pick_representative_fuelbed({}, g)