@@ -140,57 +140,57 @@ def tearDown(self):
140140 Mpy ._CHUNK_AUTO_DETECTED = None
141141
142142 def test_large_ram_uses_32k_chunks (self ):
143- """Test that devices with >256KB RAM use 32KB chunks"""
144- self .mpy ._mpy_comm .exec_eval .return_value = 300 * 1024 # 300KB
143+ """Test that devices with >320KB RAM use 32KB chunks"""
144+ self .mpy ._mpy_comm .exec_eval .return_value = 350 * 1024 # 350KB
145145 chunk = self .mpy .detect_chunk_size ()
146146 self .assertEqual (chunk , 32768 )
147147
148148 def test_medium_large_ram_uses_16k_chunks (self ):
149- """Test that devices with >128KB RAM use 16KB chunks"""
150- self .mpy ._mpy_comm .exec_eval .return_value = 150 * 1024 # 150KB
149+ """Test that devices with >192KB RAM use 16KB chunks"""
150+ self .mpy ._mpy_comm .exec_eval .return_value = 250 * 1024 # 250KB
151151 chunk = self .mpy .detect_chunk_size ()
152152 self .assertEqual (chunk , 16384 )
153153
154154 def test_medium_ram_uses_8k_chunks (self ):
155- """Test that devices with >64KB RAM use 8KB chunks"""
156- self .mpy ._mpy_comm .exec_eval .return_value = 80 * 1024 # 80KB
155+ """Test that devices with >128KB RAM use 8KB chunks"""
156+ self .mpy ._mpy_comm .exec_eval .return_value = 150 * 1024 # 150KB
157157 chunk = self .mpy .detect_chunk_size ()
158158 self .assertEqual (chunk , 8192 )
159159
160160 def test_small_ram_uses_4k_chunks (self ):
161- """Test that devices with >48KB RAM use 4KB chunks"""
162- self .mpy ._mpy_comm .exec_eval .return_value = 55 * 1024 # 55KB
161+ """Test that devices with >92KB RAM use 4KB chunks"""
162+ self .mpy ._mpy_comm .exec_eval .return_value = 100 * 1024 # 100KB
163163 chunk = self .mpy .detect_chunk_size ()
164164 self .assertEqual (chunk , 4096 )
165165
166166 def test_smaller_ram_uses_2k_chunks (self ):
167- """Test that devices with >32KB RAM use 2KB chunks"""
168- self .mpy ._mpy_comm .exec_eval .return_value = 40 * 1024 # 40KB
167+ """Test that devices with >64KB RAM use 2KB chunks"""
168+ self .mpy ._mpy_comm .exec_eval .return_value = 70 * 1024 # 70KB
169169 chunk = self .mpy .detect_chunk_size ()
170170 self .assertEqual (chunk , 2048 )
171171
172172 def test_small_ram_uses_1k_chunks (self ):
173- """Test that devices with >24KB RAM use 1KB chunks"""
174- self .mpy ._mpy_comm .exec_eval .return_value = 28 * 1024 # 28KB
173+ """Test that devices with >48KB RAM use 1KB chunks"""
174+ self .mpy ._mpy_comm .exec_eval .return_value = 55 * 1024 # 55KB
175175 chunk = self .mpy .detect_chunk_size ()
176176 self .assertEqual (chunk , 1024 )
177177
178178 def test_tiny_ram_uses_512_chunks (self ):
179- """Test that devices with <=24KB RAM use 512B chunks"""
180- self .mpy ._mpy_comm .exec_eval .return_value = 20 * 1024 # 20KB
179+ """Test that devices with >32KB RAM use 512B chunks"""
180+ self .mpy ._mpy_comm .exec_eval .return_value = 40 * 1024 # 40KB
181181 chunk = self .mpy .detect_chunk_size ()
182182 self .assertEqual (chunk , 512 )
183183
184- def test_error_defaults_to_512 (self ):
185- """Test that errors default to 512B chunks"""
184+ def test_error_defaults_to_256 (self ):
185+ """Test that errors default to 256B chunks"""
186186 from mpytool .mpy_comm import CmdError
187187 self .mpy ._mpy_comm .exec_eval .side_effect = CmdError ("cmd" , b"" , b"error" )
188188 chunk = self .mpy .detect_chunk_size ()
189- self .assertEqual (chunk , 512 )
189+ self .assertEqual (chunk , 256 )
190190
191191 def test_caches_result (self ):
192192 """Test that chunk size is cached after first detection"""
193- self .mpy ._mpy_comm .exec_eval .return_value = 300 * 1024 # 300KB
193+ self .mpy ._mpy_comm .exec_eval .return_value = 350 * 1024 # 350KB
194194 chunk1 = self .mpy .detect_chunk_size ()
195195 # Change return value - should still use cached
196196 self .mpy ._mpy_comm .exec_eval .return_value = 20 * 1024 # 20KB
@@ -340,6 +340,7 @@ def setUp(self):
340340 self .mpy = Mpy (self .mock_conn )
341341 self .mpy ._mpy_comm = Mock ()
342342 self .mpy ._platform = 'esp32' # Set platform for partition operations
343+ self .mpy ._chunk_size = 4096 # Skip chunk size detection
343344
344345 def test_flash_read_with_label_returns_bytes (self ):
345346 """Test that flash_read with label returns bytes"""
0 commit comments