@@ -438,41 +438,41 @@ def union_int():
438
438
assert python_result [0 ] == pyccel_result [0 ]
439
439
assert set (python_result [1 :]) == set (pyccel_result [1 :])
440
440
441
- def test_set_intersection_int (python_only_language ):
441
+ def test_set_intersection_int (language ):
442
442
def intersection_int ():
443
443
a = {1 ,2 ,3 }
444
444
b = {2 ,3 ,4 }
445
445
c = a .intersection (b )
446
446
return len (c ), c .pop (), c .pop ()
447
447
448
- epyccel_func = epyccel (intersection_int , language = python_only_language )
448
+ epyccel_func = epyccel (intersection_int , language = language )
449
449
pyccel_result = epyccel_func ()
450
450
python_result = intersection_int ()
451
451
assert python_result [0 ] == pyccel_result [0 ]
452
452
assert set (python_result [1 :]) == set (pyccel_result [1 :])
453
453
454
- def test_set_intersection_no_args (python_only_language ):
454
+ def test_set_intersection_no_args (language ):
455
455
def intersection_int ():
456
456
a = {1 ,2 ,3 ,4 }
457
457
c = a .intersection ()
458
458
a .add (5 )
459
459
return len (c ), c .pop (), c .pop (), c .pop (), c .pop ()
460
460
461
- epyccel_func = epyccel (intersection_int , language = python_only_language )
461
+ epyccel_func = epyccel (intersection_int , language = language )
462
462
pyccel_result = epyccel_func ()
463
463
python_result = intersection_int ()
464
464
assert python_result [0 ] == pyccel_result [0 ]
465
465
assert set (python_result [1 :]) == set (pyccel_result [1 :])
466
466
467
- def test_set_intersection_2_args (python_only_language ):
467
+ def test_set_intersection_2_args (language ):
468
468
def intersection_int ():
469
469
a = {1 ,2 ,3 ,4 }
470
470
b = {5 ,6 ,7 ,2 ,1 ,3 }
471
471
c = {7 ,6 ,10 ,4 ,2 ,3 ,1 }
472
472
d = a .intersection (b , c )
473
473
return len (d ), d .pop (), d .pop (), d .pop ()
474
474
475
- epyccel_func = epyccel (intersection_int , language = python_only_language )
475
+ epyccel_func = epyccel (intersection_int , language = language )
476
476
pyccel_result = epyccel_func ()
477
477
python_result = intersection_int ()
478
478
assert python_result [0 ] == pyccel_result [0 ]
@@ -538,52 +538,53 @@ def union_int():
538
538
assert python_result [0 ] == pyccel_result [0 ]
539
539
assert set (python_result [1 :]) == set (pyccel_result [1 :])
540
540
541
- def test_temporary_set_intersection (python_only_language ):
541
+ def test_temporary_set_intersection (language ):
542
542
def intersection_int ():
543
543
a = {1 ,2 }
544
544
b = {2 }
545
545
d = a .intersection (b ).pop ()
546
546
return d
547
547
548
- epyccel_func = epyccel (intersection_int , language = python_only_language )
548
+ epyccel_func = epyccel (intersection_int , language = language )
549
549
pyccel_result = epyccel_func ()
550
550
python_result = intersection_int ()
551
551
assert python_result == pyccel_result
552
552
553
- def test_set_intersection_list ( python_only_language ):
554
- def intersection_list ():
555
- a = {1.2 , 2.3 , 5.0 }
556
- b = [ 1.2 , 5.0 , 4.0 ]
557
- d = a . intersection ( b )
558
- return len (d ), d .pop (), d .pop ()
553
+ def test_set_intersection_operator ( language ):
554
+ def intersection_int ():
555
+ a = {1 , 2 , 3 , 4 , 8 }
556
+ b = { 5 , 2 , 3 , 7 , 8 }
557
+ c = a & b
558
+ return len (c ), c .pop (), c . pop (), c .pop ()
559
559
560
- epyccel_func = epyccel (intersection_list , language = python_only_language )
560
+ epyccel_func = epyccel (intersection_int , language = language )
561
561
pyccel_result = epyccel_func ()
562
- python_result = intersection_list ()
562
+ python_result = intersection_int ()
563
563
assert python_result [0 ] == pyccel_result [0 ]
564
564
assert set (python_result [1 :]) == set (pyccel_result [1 :])
565
565
566
- def test_set_intersection_tuple ( python_only_language ):
567
- def intersection_tuple ():
568
- a = {True }
569
- b = ( False , True )
570
- d = a . intersection (b )
571
- return len (d ), d .pop ()
566
+ def test_set_intersection_update ( language ):
567
+ def intersection_int ():
568
+ a = {1 , 2 , 3 , 4 , 8 }
569
+ b = { 5 , 2 , 3 , 7 , 8 }
570
+ a . intersection_update (b )
571
+ return len (a ), a . pop (), a . pop (), a .pop ()
572
572
573
- epyccel_func = epyccel (intersection_tuple , language = python_only_language )
573
+ epyccel_func = epyccel (intersection_int , language = language )
574
574
pyccel_result = epyccel_func ()
575
- python_result = intersection_tuple ()
575
+ python_result = intersection_int ()
576
576
assert python_result [0 ] == pyccel_result [0 ]
577
577
assert set (python_result [1 :]) == set (pyccel_result [1 :])
578
578
579
- def test_set_intersection_operator ( python_only_language ):
579
+ def test_set_intersection_multiple_update ( language ):
580
580
def intersection_int ():
581
581
a = {1 ,2 ,3 ,4 ,8 }
582
582
b = {5 ,2 ,3 ,7 ,8 }
583
- c = a & b
584
- return len (c ), c .pop (), c .pop (), c .pop ()
583
+ c = {10 ,2 ,20 }
584
+ a .intersection_update (b , c )
585
+ return len (a ), a .pop ()
585
586
586
- epyccel_func = epyccel (intersection_int , language = python_only_language )
587
+ epyccel_func = epyccel (intersection_int , language = language )
587
588
pyccel_result = epyccel_func ()
588
589
python_result = intersection_int ()
589
590
assert python_result [0 ] == pyccel_result [0 ]
@@ -613,14 +614,14 @@ def union_int():
613
614
python_result = union_int ()
614
615
assert python_result == pyccel_result
615
616
616
- def test_set_intersection_augoperator (python_only_language ):
617
+ def test_set_intersection_augoperator (language ):
617
618
def intersection_int ():
618
619
a = {1 ,2 ,3 ,4 }
619
620
b = {2 ,3 ,4 }
620
621
a &= b
621
622
return len (a ), a .pop (), a .pop (), a .pop ()
622
623
623
- epyccel_func = epyccel (intersection_int , language = python_only_language )
624
+ epyccel_func = epyccel (intersection_int , language = language )
624
625
pyccel_result = epyccel_func ()
625
626
python_result = intersection_int ()
626
627
assert python_result [0 ] == pyccel_result [0 ]
0 commit comments