Skip to content

Commit 997502f

Browse files
committed
-
1 parent c1af363 commit 997502f

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

source_py3/python_toolbox/combi/perm_space.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def __init__(self, iterable_or_length, domain=None, n_elements=None,
158158
assert isinstance(iterable_or_length, collections.Iterable)
159159
self.sequence = sequence_tools. \
160160
ensure_iterable_is_immutable_sequence(iterable_or_length)
161-
if cute_iter_tools.get_length(self.sequence) == infinity:
161+
if sequence_tools.get_length(self.sequence) == infinity:
162162
self.is_rapplied = False
163163
self.sequence_length = infinity
164164
else:
@@ -280,7 +280,7 @@ def __init__(self, iterable_or_length, domain=None, n_elements=None,
280280
else:
281281
self._get_just_fixed = lambda: PermSpace(
282282
len(self.sequence),
283-
fixed_map=self._undapplied_fixed_map,
283+
fixed_map=self._undapplied_unrapplied_fixed_map,
284284
)
285285
else:
286286
self._unsliced_undegreed_length = \

source_py3/test_python_toolbox/test_combi/test_perm_space.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Copyright 2009-2014 Ram Rachum.
22
# This program is distributed under the MIT license.
33

4+
from python_toolbox import sequence_tools
5+
46
from python_toolbox.combi import *
57

8+
infinity = float('inf')
9+
infinities = (infinity, -infinity)
10+
611

712
def test_perms():
813
pure_0a = PermSpace(4)
@@ -276,6 +281,12 @@ def test_degreed_perm_space():
276281
if i not in funky_perm_space.degrees
277282
).length == funky_perm_space.unsliced.undegreed.length
278283

284+
assert funky_perm_space._just_fixed.is_fixed
285+
assert not funky_perm_space._just_fixed.is_rapplied
286+
assert not funky_perm_space._just_fixed.is_dapplied
287+
assert not funky_perm_space._just_fixed.is_sliced
288+
assert not funky_perm_space._just_fixed.is_degreed
289+
279290

280291
def test_partial_perm_space():
281292
with cute_testing.RaiseAssertor():
@@ -385,6 +396,14 @@ def test_neighbors():
385396

386397

387398

399+
def test_infinite_perm_space():
400+
perm_space = PermSpace(sequence_tools.CuteRange(infinity))
401+
assert perm_space.length == infinity
402+
assert perm_space == infinite_pure_perm_space
403+
assert perm_space[100].length == infinity
404+
405+
406+
388407
def test_super_structure():
389408
# blocktodo do a whole thing with mapspaces and somethingspacespaceshit
390409
pass

0 commit comments

Comments
 (0)