1010# ___________________________________________________________________________
1111
1212import pyomo .common .unittest as unittest
13- from pyomo .solvers .amplfunc_merge import amplfunc_string_merge , amplfunc_merge
13+ from pyomo .solvers .amplfunc_merge import unique_paths , amplfunc_merge
1414
1515
1616class TestAMPLFUNCStringMerge (unittest .TestCase ):
1717 def test_merge_no_dup (self ):
1818 s1 = "my/place/l1.so\n another/place/l1.so"
1919 s2 = "my/place/l2.so"
20- sm = amplfunc_string_merge (s1 , s2 )
20+ sm = unique_paths (s1 , s2 )
2121 sm_list = sm .split ("\n " )
2222 self .assertEqual (len (sm_list ), 3 )
2323 # The order of lines should be maintained with the second string
@@ -29,40 +29,40 @@ def test_merge_no_dup(self):
2929 def test_merge_empty1 (self ):
3030 s1 = ""
3131 s2 = "my/place/l2.so"
32- sm = amplfunc_string_merge (s1 , s2 )
32+ sm = unique_paths (s1 , s2 )
3333 sm_list = sm .split ("\n " )
3434 self .assertEqual (len (sm_list ), 1 )
3535 self .assertEqual (sm_list [0 ], "my/place/l2.so" )
3636
3737 def test_merge_empty2 (self ):
3838 s1 = "my/place/l2.so"
3939 s2 = ""
40- sm = amplfunc_string_merge (s1 , s2 )
40+ sm = unique_paths (s1 , s2 )
4141 sm_list = sm .split ("\n " )
4242 self .assertEqual (len (sm_list ), 1 )
4343 self .assertEqual (sm_list [0 ], "my/place/l2.so" )
4444
4545 def test_merge_empty_both (self ):
4646 s1 = ""
4747 s2 = ""
48- sm = amplfunc_string_merge (s1 , s2 )
48+ sm = unique_paths (s1 , s2 )
4949 sm_list = sm .split ("\n " )
5050 self .assertEqual (len (sm_list ), 1 )
5151 self .assertEqual (sm_list [0 ], "" )
5252
5353 def test_merge_bad_type (self ):
54- self .assertRaises (AttributeError , amplfunc_string_merge , "" , 3 )
55- self .assertRaises (AttributeError , amplfunc_string_merge , 3 , "" )
56- self .assertRaises (AttributeError , amplfunc_string_merge , 3 , 3 )
57- self .assertRaises (AttributeError , amplfunc_string_merge , None , "" )
58- self .assertRaises (AttributeError , amplfunc_string_merge , "" , None )
59- self .assertRaises (AttributeError , amplfunc_string_merge , 2.3 , "" )
60- self .assertRaises (AttributeError , amplfunc_string_merge , "" , 2.3 )
54+ self .assertRaises (AttributeError , unique_paths , "" , 3 )
55+ self .assertRaises (AttributeError , unique_paths , 3 , "" )
56+ self .assertRaises (AttributeError , unique_paths , 3 , 3 )
57+ self .assertRaises (AttributeError , unique_paths , None , "" )
58+ self .assertRaises (AttributeError , unique_paths , "" , None )
59+ self .assertRaises (AttributeError , unique_paths , 2.3 , "" )
60+ self .assertRaises (AttributeError , unique_paths , "" , 2.3 )
6161
6262 def test_merge_duplicate1 (self ):
6363 s1 = "my/place/l1.so\n another/place/l1.so"
6464 s2 = "my/place/l1.so\n another/place/l1.so"
65- sm = amplfunc_string_merge (s1 , s2 )
65+ sm = unique_paths (s1 , s2 )
6666 sm_list = sm .split ("\n " )
6767 self .assertEqual (len (sm_list ), 2 )
6868 # The order of lines should be maintained with the second string
@@ -73,7 +73,7 @@ def test_merge_duplicate1(self):
7373 def test_merge_duplicate2 (self ):
7474 s1 = "my/place/l1.so\n another/place/l1.so"
7575 s2 = "my/place/l1.so"
76- sm = amplfunc_string_merge (s1 , s2 )
76+ sm = unique_paths (s1 , s2 )
7777 sm_list = sm .split ("\n " )
7878 self .assertEqual (len (sm_list ), 2 )
7979 # The order of lines should be maintained with the second string
@@ -84,7 +84,7 @@ def test_merge_duplicate2(self):
8484 def test_merge_extra_linebreaks (self ):
8585 s1 = "\n my/place/l1.so\n another/place/l1.so\n "
8686 s2 = "\n my/place/l1.so\n \n "
87- sm = amplfunc_string_merge (s1 , s2 )
87+ sm = unique_paths (s1 , s2 )
8888 sm_list = sm .split ("\n " )
8989 self .assertEqual (len (sm_list ), 2 )
9090 # The order of lines should be maintained with the second string
0 commit comments