Skip to content

Commit

Permalink
Ensure all generated maps are ranked (#1039)
Browse files Browse the repository at this point in the history
* Expand generated map regex

* Add test for `is_neroxis_map`

---------

Co-authored-by: Askaholic <[email protected]>
  • Loading branch information
Sheikah45 and Askaholic authored Feb 1, 2025
1 parent 181bee8 commit c541105
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class NeroxisGeneratedMap(NamedTuple):
weight: int = 1

_NAME_PATTERN = re.compile(
"neroxis_map_generator_([0-9.]+)_([a-z2-7]+)_([a-z2-7]+)"
"neroxis_map_generator_([0-9.]+)_.+"
)

@classmethod
Expand Down
14 changes: 13 additions & 1 deletion tests/unit_tests/test_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from server.types import Address
from server.types import Address, NeroxisGeneratedMap


def test_address_from_string():
Expand All @@ -11,3 +11,15 @@ def test_address_from_string_with_scheme():
address = Address.from_string("http://localhost:4000")

assert address == Address("http://localhost", 4000)


def test_is_neroxis_map():
assert NeroxisGeneratedMap.is_neroxis_map(
"neroxis_map_generator_1.13.0_htvbrglnjszew_baeaeaa_aaaaaadhlwmjq",
) is True
assert NeroxisGeneratedMap.is_neroxis_map(
"neroxis_map_generator_1.13.0_zxgxph43rfbj4_aycaeaa_aaaaaadhlwuas",
) is True
assert NeroxisGeneratedMap.is_neroxis_map(
"neroxis_map_generator_1.13.0_avkycu6ce63e2_baeaeaa_aaaaaadhlxdhe",
) is True

0 comments on commit c541105

Please sign in to comment.