Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_dflee is unstable #107

Open
djgroen opened this issue Jul 17, 2024 · 1 comment
Open

test_dflee is unstable #107

djgroen opened this issue Jul 17, 2024 · 1 comment
Assignees
Labels

Comments

@djgroen
Copy link
Owner

djgroen commented Jul 17, 2024

test_dflee periodically throws an error, as it appears to deliver unstable outcomes. Perhaps the assertions are too tight?

@djgroen djgroen added the bug label Jul 17, 2024
@djgroen djgroen pinned this issue Jul 17, 2024
@djgroen
Copy link
Owner Author

djgroen commented Jul 17, 2024

Example error:

>               assert e.agents[0].location.name == "A"
E               AssertionError: assert 'B' == 'A'
E                 - A
E                 + B

tests/test_dflee.py:344: AssertionError
------------------------------------------------------------------------------------------- Captured stdout call -------------------------------------------------------------------------------------------
locations [['A', 'AB', 'ABC', '1.0', '1.0', 'flood_zone', '', '200000000', ''], ['B', 'AB', 'ABC', '1.0', '1.0', 'flood_zone', '', '1000000000', ''], ['C', 'C', 'ABC', '1.0', '1.0', 'town', '', '100', ''], ['C2', 'C', 'ABC', '1.0', '1.0', 'town', '', '200', ''], ['D', 'D', 'DEF', '1.0', '1.0', 'camp', '', '30000', ''], ['E', 'EF', 'DEF', '1.0', '1.0', 'camp', '', '20000', ''], ['F', 'EF', 'DEF', '1.0', '1.0', 'camp', '', '10000', '']]
{'A': [0, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1], 'B': [1, 1, 1, 3, 1, 1, 0, 0, 0, 0, 1]}
{'A': [0, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1], 'B': [1, 1, 1, 3, 1, 1, 0, 0, 0, 0, 1]}
0 100 100 100 100 100 100 100
------------------------------------------------------------------------------------------- Captured stderr call -------------------------------------------------------------------------------------------
YAML file: empty.yml
YAML: None
Take from population? false
Spawn decay set to: None, with interval 30
Move rules set to: {'FloodRulesEnabled': False, 'FloodForecaster': False, 'flood_forecaster_timescale': 0, 'MaxMoveSpeed': 360.0, 'MaxWalkSpeed': 35.0, 'MaxCrossingSpeed': 20.0, 'ForeignWeight': 1.0, 'CampWeight': 1.0, 'ConflictWeight': 0.31622776601667585, 'ConflictMoveChance': 1.0, 'CampMoveChance': 0.001, 'IDPCampMoveChance': 0.1, 'DefaultMoveChance': 0.3, 'AwarenessLevel': 1, 'CapacityBuffer': 0.9, 'CapacityScaling': 1.0, 'AvoidShortStints': False, 'StartOnFoot': False, 'DistanceSoftening': 10.0, 'WeightSoftening': 0.0, 'WeightPower': 1.0, 'DistancePower': 1.0, 'StayCloseToHome': False, 'HomeDistancePower': 0.5, 'UsePopForLocWeight': False, 'PopPowerForLocWeight': 0.1, 'MovechancePopBase': 10000.0, 'MovechancePopScaleFactor': 0.0, 'PruningThreshold': 1.0, 'ChildrenAvoidHazards': False, 'BoysTakeRisk': False, 'MatchCampEthnicity': False, 'MatchTownEthnicity': False, 'MatchConflictEthnicity': False, 'FloodLocWeights': [0.0, 1.0, 1.0, 1.0, 1.0], 'FloodMovechances': [0.0, 1.0, 1.0, 1.0, 1.0], 'FloodForecasterTimescale': 2, 'FloodForecasterEndTime': 6, 'FloodForecasterWeights': [1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.3, 0.1, 0.3, 0.3, 0.1, 0.1, 0.1, 0.0, 0.0], 'FloodAwarenessWeights': [0.0, 0.5, 1.0]}
appending
header ['name', 'region', 'country', 'gps_x', 'gps_y', 'location_type', 'conflict_date', 'pop/cap', ''] ['#"name"', 'region', 'country', 'lat', 'lon', 'location_type', 'conflict_date', 'population', ''] 9
link header ['name1', 'name2', 'distance', 'forced_redirection'] ['#"name1"', 'name2', 'distance', 'forced_redirection'] 4
Home country set to:  ABC
Location name: A, X: 1.0, Y: 1.0, movechance: 0.3, cap: -1, pop: 200000000, country: ABC, conflict? -1.0, camp? False, flood_zone? True, foreign? False, attributes: {'': ''}
Location name: B, X: 1.0, Y: 1.0, movechance: 0.3, cap: -1, pop: 1000000000, country: ABC, conflict? -1.0, camp? False, flood_zone? True, foreign? False, attributes: {'': ''}
Location name: C, X: 1.0, Y: 1.0, movechance: 0.3, cap: -1, pop: 100, country: ABC, conflict? -1.0, camp? False, flood_zone? False, foreign? False, attributes: {'': ''}
Location name: C2, X: 1.0, Y: 1.0, movechance: 0.3, cap: -1, pop: 200, country: ABC, conflict? -1.0, camp? False, flood_zone? False, foreign? False, attributes: {'': ''}
Location name: D, X: 1.0, Y: 1.0, movechance: 0.001, cap: 30000, pop: 0, country: DEF, conflict? -1.0, camp? True, flood_zone? False, foreign? True, attributes: {'': ''}
Location name: E, X: 1.0, Y: 1.0, movechance: 0.001, cap: 20000, pop: 0, country: DEF, conflict? -1.0, camp? True, flood_zone? False, foreign? True, attributes: {'': ''}
Location name: F, X: 1.0, Y: 1.0, movechance: 0.001, cap: 10000, pop: 0, country: DEF, conflict? -1.0, camp? True, flood_zone? False, foreign? True, attributes: {'': ''}
Warning: location graph has 0 conflict zones (ignore if conflicts.csv is used).
========================================================================================= short test summary info ==========================================================================================
FAILED tests/test_dflee.py::test_agent_flood_awareness - AssertionError: assert 'B' == 'A'
======================================================================================= 1 failed, 25 passed in 2.27s =======================================================================================
c

To reproduce this and other errors in this test, you may need to rerun pytest locally 10+ times.

This can be done by using:
pytest tests/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants