Changeset 3738

Show
Ignore:
Timestamp:
07/03/08 10:30:05 (7 weeks ago)
Author:
borning
Message:

fixed unit test

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/urbansim/household_x_zone/household_size_times_population_per_acre.py

    r460 r3738  
    3535from numpy import ma 
    3636class Tests(opus_unittest.OpusTestCase): 
    37     variable_name = "urbansim.household_x_zone.income_times_housing_cost" 
     37    variable_name = "urbansim.household_x_zone.household_size_times_population_per_acre" 
    3838    def test_my_inputs(self): 
    39         housing_cost = array([333.0, 500.55, 1000.26, 459]) 
    40         income = array([1, 20, 500]) 
     39        population_per_acre = array([100, 200, 400, 200]) 
     40        persons = array([1, 4, 2]) 
    4141 
    4242        values = VariableTestToolbox().compute_variable(self.variable_name,  
    4343            {"zone":{  
    44                 "average_housing_cost":housing_cost},  
     44                "population_per_acre":population_per_acre},  
    4545            "household":{  
    46                 "income":income}},  
     46                "persons":persons}},  
    4747            dataset = "household_x_zone") 
    48         should_be = array([[333.0, 500.55, 1000.26, 459.0], [6660.0, 10011., 20005.2, 9180],  
    49                             [166500.,  250275.,  500130.,  229500.]]) 
     48        should_be = array([[100, 200, 400, 200], [400, 800, 1600, 800],  
     49                            [200, 400, 800, 400]]) 
    5050        self.assertEqual(ma.allclose(values, should_be, rtol=1e-3), 
    5151                         True, msg = "Error in " + self.variable_name)