| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | import json | 
					
						
							|  |  |  | import re | 
					
						
							|  |  |  | import subprocess | 
					
						
							|  |  |  | import sys | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | import unittest | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | from BaseClasses import get_seed | 
					
						
							| 
									
										
										
										
											2025-05-13 03:58:03 -04:00
										 |  |  | from ..bases import SVTestCase | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | # <function Location.<lambda> at 0x102ca98a0> | 
					
						
							|  |  |  | lambda_regex = re.compile(r"^<function Location\.<lambda> at (.*)>$") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestGenerationIsStable(SVTestCase): | 
					
						
							|  |  |  |     """Let it be known that I hate this tests, and if someone has a better idea than starting subprocesses, please fix this.
 | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_all_locations_and_items_are_the_same_between_two_generations(self): | 
					
						
							|  |  |  |         if self.skip_long_tests: | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |             raise unittest.SkipTest("Long tests disabled") | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-26 05:33:14 -04:00
										 |  |  |         seed = get_seed() | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |         output_a = subprocess.check_output([sys.executable, '-m', 'worlds.stardew_valley.test.stability.StabilityOutputScript', '--seed', str(seed)]) | 
					
						
							|  |  |  |         output_b = subprocess.check_output([sys.executable, '-m', 'worlds.stardew_valley.test.stability.StabilityOutputScript', '--seed', str(seed)]) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-29 19:46:35 -05:00
										 |  |  |         result_a = json.loads(output_a) | 
					
						
							|  |  |  |         result_b = json.loads(output_b) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |         for i, ((room_a, bundles_a), (room_b, bundles_b)) in enumerate(zip(result_a["bundles"].items(), result_b["bundles"].items())): | 
					
						
							|  |  |  |             self.assertEqual(room_a, room_b, f"Bundle rooms at index {i} is different between both executions. Seed={seed}") | 
					
						
							|  |  |  |             for j, ((bundle_a, items_a), (bundle_b, items_b)) in enumerate(zip(bundles_a.items(), bundles_b.items())): | 
					
						
							|  |  |  |                 self.assertEqual(bundle_a, bundle_b, f"Bundle in room {room_a} at index {j} is different between both executions. Seed={seed}") | 
					
						
							|  |  |  |                 self.assertEqual(items_a, items_b, f"Items in bundle {bundle_a} are different between both executions. Seed={seed}") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for i, (item_a, item_b) in enumerate(zip(result_a["items"], result_b["items"])): | 
					
						
							|  |  |  |             self.assertEqual(item_a, item_b, f"Item at index {i} is different between both executions. Seed={seed}") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for i, ((location_a, rule_a), (location_b, rule_b)) in enumerate(zip(result_a["location_rules"].items(), result_b["location_rules"].items())): | 
					
						
							|  |  |  |             self.assertEqual(location_a, location_b, f"Location at index {i} is different between both executions. Seed={seed}") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             match = lambda_regex.match(rule_a) | 
					
						
							|  |  |  |             if match: | 
					
						
							|  |  |  |                 self.assertTrue(bool(lambda_regex.match(rule_b)), | 
					
						
							|  |  |  |                                 f"Location rule of {location_a} at index {i} is different between both executions. Seed={seed}") | 
					
						
							|  |  |  |                 continue | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             # We check that the actual rule has the same order to make sure it is evaluated in the same order, | 
					
						
							|  |  |  |             #  so performance tests are repeatable as much as possible. | 
					
						
							|  |  |  |             self.assertEqual(rule_a, rule_b, f"Location rule of {location_a} at index {i} is different between both executions. Seed={seed}") | 
					
						
							| 
									
										
										
										
											2024-07-26 05:33:14 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         for key, value in result_a["slot_data"].items(): | 
					
						
							|  |  |  |             self.assertEqual(value, result_b["slot_data"][key], f"Slot data {key} is different between both executions. Seed={seed}") |