@@ -27,6 +27,13 @@ def test_hpcombi_vect16_hash():
2727 d = {Vect16 ([0 , 10 ]): 0 }
2828 assert d [Vect16 ([0 , 10 ])] == 0
2929
30+ def test_hpcombi_vect16_copy ():
31+ x = Vect16 ([1 , 2 , 0 ])
32+ assert copy (x ) is not x
33+ assert x .copy () is not x
34+ assert x .copy () == copy (x )
35+ assert isinstance (x .copy (), Vect16 )
36+
3037 def test_hpcombi_vect16_construct_from_list ():
3138 x = Vect16 ([0 , 10 ])
3239 assert x [0 ] == 0
@@ -131,10 +138,17 @@ def test_hpcombi_vect16_is_permutation():
131138 # PTransf16
132139 ########################################################################
133140
134- def test_hpcombi_ptransf_hash ():
141+ def test_hpcombi_ptransf16_hash ():
135142 d = {PTransf16 ([0 , 10 ]): 0 }
136143 assert d [PTransf16 ([0 , 10 ])] == 0
137144
145+ def test_hpcombi_ptransf16_copy ():
146+ x = PTransf16 ([1 , 2 , 0 ])
147+ assert copy (x ) is not x
148+ assert x .copy () is not x
149+ assert x .copy () == copy (x )
150+ assert isinstance (x .copy (), PTransf16 )
151+
138152 def test_hpcombi_ptransf16_construct_from_list ():
139153 x = PTransf16 ([0 , 10 ])
140154 assert x [0 ] == 0
@@ -185,15 +199,17 @@ def test_hpcombi_ptransf16_one():
185199 assert PTransf16 .one () == PTransf16 (list (range (16 )))
186200 x = PTransf16 ([1 , 0 , 1 ])
187201 assert x .one () == PTransf16 .one ()
202+ assert isinstance (PTransf16 .one (), PTransf16 )
188203
189204 def test_hpcombi_ptransf16_len ():
190205 assert len (PTransf16 ()) == 16
191206
192207 def test_hpcombi_ptransf16_validate ():
193208 assert PTransf16 .one ().validate ()
194209 assert PTransf16 .one ().validate (3 )
195- # FIXME the following should return true, i.e. PTransf16 should
196- # always return True unless there's a value > 16 and != 255
210+ # TODO update the following line if
211+ # https://github.com/libsemigroups/HPCombi/issues/64
212+ # is resolved.
197213 assert not PTransf16 ([0 , 1 , 255 ]).validate (3 )
198214
199215 def test_hpcombi_ptransf16_image_mask ():
@@ -299,16 +315,23 @@ def test_hpcombi_ptransf_nb_fix_points():
299315 # Transf16
300316 ########################################################################
301317
302- def test_hpcombi_transf_hash ():
318+ def test_hpcombi_transf16_hash ():
303319 d = {Transf16 ([0 , 10 ]): 0 }
304320 assert d [Transf16 ([0 , 10 ])] == 0
305321
322+ def test_hpcombi_transf16_copy ():
323+ x = Transf16 ([1 , 2 , 0 ])
324+ assert copy (x ) is not x
325+ assert x .copy () is not x
326+ assert x .copy () == copy (x )
327+ assert isinstance (x .copy (), Transf16 )
328+
306329 def test_hpcombi_transf16_construct_from_list ():
307330 x = Transf16 ([0 , 10 ])
308331 assert x [0 ] == 0
309332 assert x [1 ] == 10
310333 for i in range (2 , 16 ):
311- assert x [i ] == 0
334+ assert x [i ] == 10
312335 with pytest .raises (LibsemigroupsError ):
313336 x = Transf16 ([0 ] * 17 )
314337 with pytest .raises (LibsemigroupsError ):
@@ -319,11 +342,11 @@ def test_hpcombi_transf16_construct_from_list():
319342 def test_hpcombi_transf16_set_item ():
320343 x = Transf16 ()
321344 x [1 ] = 10
322- assert x == Transf16 ([0 , 10 ])
345+ assert x == Transf16 ([0 , 10 ] + [ 0 ] * 14 )
323346
324347 def test_hpcombi_transf16_to_from_ints ():
325348 x = Transf16 ([0 , 15 ])
326- assert int (x ) == 3840
349+ assert int (x ) == 18446744073709551600
327350 assert Transf16 (int (x )) == x
328351
329352 def test_hpcombi_transf16_lt ():
@@ -341,6 +364,7 @@ def test_hpcombi_transf16_mul():
341364
342365 def test_hpcombi_transf16_one ():
343366 assert Transf16 .one () == Transf16 (list (range (16 )))
367+ assert isinstance (Transf16 .one (), Transf16 )
344368
345369 ########################################################################
346370 # Perm16
@@ -351,7 +375,6 @@ def test_hpcombi_perm_hash():
351375 assert d [Perm16 ([1 , 0 ])] == 0
352376
353377 def test_hpcombi_perm16_copy ():
354- # TODO replicate this test for the other types
355378 x = Perm16 ([1 , 2 , 0 ])
356379 assert copy (x ) is not x
357380 assert x .copy () is not x
@@ -362,7 +385,7 @@ def test_hpcombi_perm16_one():
362385 assert Perm16 .one () == Perm16 (list (range (16 )))
363386 x = Perm16 ([1 , 2 , 0 ])
364387 assert x .one () == Perm16 .one ()
365- assert isinstance (x .one (), Perm16 ) # TODO add this to the other test cases
388+ assert isinstance (x .one (), Perm16 )
366389
367390 def test_hpcombi_perm16_inverse ():
368391 x = Perm16 ([1 , 2 , 0 ])
@@ -483,12 +506,11 @@ def test_hpcombi_perm16_unrankSJT(): # pylint: disable=invalid-name
483506 # PPerm16
484507 ########################################################################
485508
486- def test_hpcombi_pperm_hash ():
509+ def test_hpcombi_pperm16_hash ():
487510 d = {PPerm16 ([1 , 0 ]): 0 }
488511 assert d [PPerm16 ([1 , 0 ])] == 0
489512
490513 def test_hpcombi_pperm16_copy ():
491- # TODO replicate this test for the other types
492514 x = PPerm16 ([1 , 2 , 0 ])
493515 assert copy (x ) is not x
494516 assert x .copy () is not x
@@ -538,10 +560,9 @@ def test_hpcombi_pperm16_left_one():
538560 assert x .left_one () * x == x
539561
540562 def test_hpcombi_pperm16_inverse_ref ():
541- x = Perm16 ([1 , 2 , 0 ])
563+ x = PPerm16 ([1 , 2 , 0 ])
542564 assert x * x .inverse_ref () * x == x
543565 assert x .inverse_ref () * x * x .inverse_ref () == x .inverse_ref ()
544566 assert x * x .inverse_ref () == x .left_one ()
545567 assert x .inverse_ref () * x == x .right_one ()
546- assert x .inverse_ref () * x * x .inverse_ref () == x .inverse_ref ()
547568 assert x ** - 1 == x .inverse_ref ()
0 commit comments