import unittest
import permstruct
import permstruct.dag

class TestTravis(unittest.TestCase):
    def test_travis(self):
        perm_prop = lambda p: p.avoids([2,3,1])
        perm_bound = 6
        inp_dag = permstruct.dag.incr_decr(perm_prop, perm_bound)
        sol_iter = permstruct.construct_rule(perm_prop, perm_bound, inp_dag, (3, 3), 4, 100)
        for sol in sol_iter:

            print '===================================='
            print ""
            for rule in sol:
                print(rule)
                print ""


import unittest
import permstruct
import permstruct.dag
import sys

class TestTravis(unittest.TestCase):
    def test_travis(self):
        perm_prop = lambda p: p.avoids([2,3,1])
        perm_bound = 6
        inp_dag = permstruct.dag.incr_decr(perm_prop, perm_bound)
        sol_iter = permstruct.construct_rule(perm_prop, perm_bound, inp_dag, (3, 3), 4, 100)
        for sol in sol_iter:

            sys.stdout.write('====================================\n')
            sys.stdout.write('\n')
            for rule in sol:
                sys.stdout.write('%s\n\n' % rule)


Make tests working with python 2 and 3
Make tests working with python 2 and 3

  import unittest
  import permstruct
  import permstruct.dag
+ import sys
  
  class TestTravis(unittest.TestCase):
      def test_travis(self):
          perm_prop = lambda p: p.avoids([2,3,1])
          perm_bound = 6
          inp_dag = permstruct.dag.incr_decr(perm_prop, perm_bound)
          sol_iter = permstruct.construct_rule(perm_prop, perm_bound, inp_dag, (3, 3), 4, 100)
          for sol in sol_iter:
  
-             print '===================================='
+             sys.stdout.write('====================================\n')
-             print ""
+             sys.stdout.write('\n')
              for rule in sol:
+                 sys.stdout.write('%s\n\n' % rule)
-                 print(rule)
-                 print ""
  
  
Make tests working with python 2 and 3
## Code Before:
import unittest
import permstruct
import permstruct.dag

class TestTravis(unittest.TestCase):
    def test_travis(self):
        perm_prop = lambda p: p.avoids([2,3,1])
        perm_bound = 6
        inp_dag = permstruct.dag.incr_decr(perm_prop, perm_bound)
        sol_iter = permstruct.construct_rule(perm_prop, perm_bound, inp_dag, (3, 3), 4, 100)
        for sol in sol_iter:

            print '===================================='
            print ""
            for rule in sol:
                print(rule)
                print ""


## Instruction:
Make tests working with python 2 and 3
## Code After:
import unittest
import permstruct
import permstruct.dag
import sys

class TestTravis(unittest.TestCase):
    def test_travis(self):
        perm_prop = lambda p: p.avoids([2,3,1])
        perm_bound = 6
        inp_dag = permstruct.dag.incr_decr(perm_prop, perm_bound)
        sol_iter = permstruct.construct_rule(perm_prop, perm_bound, inp_dag, (3, 3), 4, 100)
        for sol in sol_iter:

            sys.stdout.write('====================================\n')
            sys.stdout.write('\n')
            for rule in sol:
                sys.stdout.write('%s\n\n' % rule)

