File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Expand file tree Collapse file tree 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
66
77## [ Unreleased]
88
9+ ### Fixed
10+
11+ - ` tcod.noise.grid ` would raise ` TypeError ` when given a plain integer for scale.
12+
913## [ 18.0.0] - 2025-04-08
1014
1115### Changed
Original file line number Diff line number Diff line change @@ -411,7 +411,7 @@ def grid(
411411 scale : tuple [float , ...] | float ,
412412 origin : tuple [int , ...] | None = None ,
413413 indexing : Literal ["ij" , "xy" ] = "xy" ,
414- ) -> tuple [NDArray [Any ], ...]:
414+ ) -> tuple [NDArray [np . number ], ...]:
415415 """Generate a mesh-grid of sample points to use with noise sampling.
416416
417417 Args:
@@ -449,7 +449,7 @@ def grid(
449449
450450 .. versionadded:: 12.2
451451 """
452- if isinstance (scale , float ):
452+ if isinstance (scale , ( int , float ) ):
453453 scale = (scale ,) * len (shape )
454454 if origin is None :
455455 origin = (0 ,) * len (shape )
Original file line number Diff line number Diff line change 77import pytest
88
99import tcod .noise
10+ import tcod .random
1011
1112# ruff: noqa: D103
1213
@@ -100,3 +101,7 @@ def test_noise_copy() -> None:
100101 assert repr (noise3 ) == repr (pickle .loads (pickle .dumps (noise3 )))
101102 noise4 = tcod .noise .Noise (2 , seed = 42 )
102103 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