import pprint
import sys

from st2actions.runners.pythonrunner import Action

__all__ = [
    'AssertObjectEquals'
]


class AssertObjectEquals(Action):
    def run(self, object, expected):
        ret = cmp(object, expected)

        if ret == 0:
            sys.stdout.write('EQUAL.')
        else:
            pprint.pprint('Input: \n%s' % object, stream=sys.stderr)
            pprint.pprint('Expected: \n%s' % expected, stream=sys.stderr)
            raise ValueError('Objects not equal. Input: %s, Expected: %s.' % (object, expected))

import pprint
import sys

from st2actions.runners.pythonrunner import Action

__all__ = [
    'AssertObjectEquals'
]


def cmp(x, y):
    return (x > y) - (x < y)


class AssertObjectEquals(Action):
    def run(self, object, expected):
        ret = cmp(object, expected)

        if ret == 0:
            sys.stdout.write('EQUAL.')
        else:
            pprint.pprint('Input: \n%s' % object, stream=sys.stderr)
            pprint.pprint('Expected: \n%s' % expected, stream=sys.stderr)
            raise ValueError('Objects not equal. Input: %s, Expected: %s.' % (object, expected))

Make action python 3 compatible
Make action python 3 compatible

  import pprint
  import sys
  
  from st2actions.runners.pythonrunner import Action
  
  __all__ = [
      'AssertObjectEquals'
  ]
+ 
+ 
+ def cmp(x, y):
+     return (x > y) - (x < y)
  
  
  class AssertObjectEquals(Action):
      def run(self, object, expected):
          ret = cmp(object, expected)
  
          if ret == 0:
              sys.stdout.write('EQUAL.')
          else:
              pprint.pprint('Input: \n%s' % object, stream=sys.stderr)
              pprint.pprint('Expected: \n%s' % expected, stream=sys.stderr)
              raise ValueError('Objects not equal. Input: %s, Expected: %s.' % (object, expected))
  
Make action python 3 compatible
## Code Before:
import pprint
import sys

from st2actions.runners.pythonrunner import Action

__all__ = [
    'AssertObjectEquals'
]


class AssertObjectEquals(Action):
    def run(self, object, expected):
        ret = cmp(object, expected)

        if ret == 0:
            sys.stdout.write('EQUAL.')
        else:
            pprint.pprint('Input: \n%s' % object, stream=sys.stderr)
            pprint.pprint('Expected: \n%s' % expected, stream=sys.stderr)
            raise ValueError('Objects not equal. Input: %s, Expected: %s.' % (object, expected))

## Instruction:
Make action python 3 compatible
## Code After:
import pprint
import sys

from st2actions.runners.pythonrunner import Action

__all__ = [
    'AssertObjectEquals'
]


def cmp(x, y):
    return (x > y) - (x < y)


class AssertObjectEquals(Action):
    def run(self, object, expected):
        ret = cmp(object, expected)

        if ret == 0:
            sys.stdout.write('EQUAL.')
        else:
            pprint.pprint('Input: \n%s' % object, stream=sys.stderr)
            pprint.pprint('Expected: \n%s' % expected, stream=sys.stderr)
            raise ValueError('Objects not equal. Input: %s, Expected: %s.' % (object, expected))
