Buckets:
| """Tests for environment reset and initial state.""" | |
| from cropRL.server.cropRL_environment import CroprlEnvironment | |
| class TestReset: | |
| def test_initial_cash(self, env): | |
| obs = env.reset(seed=42) | |
| assert obs.cash_balance == 10000.0 | |
| def test_initial_state_clean(self, env): | |
| obs = env.reset(seed=42) | |
| assert obs.active_crop_type == 0 | |
| assert obs.crop_age_months == 0 | |
| assert obs.stored_amount == 0.0 | |
| assert obs.current_debt == 0.0 | |
| assert obs.current_step == 0 | |
| assert obs.current_month == 1 | |
| assert obs.done is False | |
| def test_initial_soil_nitrogen(self, env): | |
| obs = env.reset(seed=42) | |
| assert obs.soil_nitrogen == 0.6 | |
| def test_reproducibility_with_seed(self): | |
| e1 = CroprlEnvironment() | |
| obs1 = e1.reset(seed=123) | |
| e2 = CroprlEnvironment() | |
| obs2 = e2.reset(seed=123) | |
| assert obs1.expected_rainfall == obs2.expected_rainfall | |
| assert obs1.market_price_crop_1 == obs2.market_price_crop_1 | |
| def test_different_seeds_different_values(self): | |
| e1 = CroprlEnvironment() | |
| obs1 = e1.reset(seed=1) | |
| e2 = CroprlEnvironment() | |
| obs2 = e2.reset(seed=999) | |
| assert ( | |
| obs1.expected_rainfall != obs2.expected_rainfall | |
| or obs1.market_price_crop_1 != obs2.market_price_crop_1 | |
| ) | |
Xet Storage Details
- Size:
- 1.38 kB
- Xet hash:
- 10bd0647019c9d3656d621b5014bf29a36f3b60d459b76af0b5c68a387e51d3a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.