File tree 3 files changed +11
-2
lines changed
3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ This project adheres to [Semantic Versioning](https://semver.org/) since version
6
6
7
7
## [ Unreleased]
8
8
9
+ ### Fixed
10
+
11
+ - ` tcod.noise.grid ` would raise ` TypeError ` when given a plain integer for scale.
12
+
9
13
## [ 18.0.0] - 2025-04-08
10
14
11
15
### Changed
Original file line number Diff line number Diff line change @@ -411,7 +411,7 @@ def grid(
411
411
scale : tuple [float , ...] | float ,
412
412
origin : tuple [int , ...] | None = None ,
413
413
indexing : Literal ["ij" , "xy" ] = "xy" ,
414
- ) -> tuple [NDArray [Any ], ...]:
414
+ ) -> tuple [NDArray [np . number ], ...]:
415
415
"""Generate a mesh-grid of sample points to use with noise sampling.
416
416
417
417
Args:
@@ -449,7 +449,7 @@ def grid(
449
449
450
450
.. versionadded:: 12.2
451
451
"""
452
- if isinstance (scale , float ):
452
+ if isinstance (scale , ( int , float ) ):
453
453
scale = (scale ,) * len (shape )
454
454
if origin is None :
455
455
origin = (0 ,) * len (shape )
Original file line number Diff line number Diff line change 7
7
import pytest
8
8
9
9
import tcod .noise
10
+ import tcod .random
10
11
11
12
# ruff: noqa: D103
12
13
@@ -100,3 +101,7 @@ def test_noise_copy() -> None:
100
101
assert repr (noise3 ) == repr (pickle .loads (pickle .dumps (noise3 )))
101
102
noise4 = tcod .noise .Noise (2 , seed = 42 )
102
103
assert repr (noise4 ) == repr (pickle .loads (pickle .dumps (noise4 )))
104
+
105
+
106
+ def test_noise_grid () -> None :
107
+ tcod .noise .grid ((2 , 2 ), scale = 2 ) # Check int scale
You can’t perform that action at this time.
0 commit comments