
"""Simple streaming test"""

from sparktestingbase.streamingtestcase import StreamingTestCase
import unittest2


class SimpleStreamingTest(StreamingTestCase):
    """A simple test."""

    @classmethod
    def tokenize(cls, f):
        return f.flatMap(lambda line: line.split(" "))
    
    def test_simple_transformation(self):
        input = [["hi"], ["hi holden"], ["bye"]]
        expected = [["hi"], ["hi", "holden"], ["bye"]]
        self.run_func(input, SimpleStreamingTest.tokenize, expected)

if __name__ == "__main__":
    unittest2.main()


"""Simple streaming test"""

from sparktestingbase.streamingtestcase import StreamingTestCase
import unittest2


class SimpleStreamingTest(StreamingTestCase):
    """A simple test."""

    @classmethod
    def tokenize(cls, f):
        return f.flatMap(lambda line: line.split(" "))

    @classmethod
    def noop(cls, f):
        return f.map(lambda x: x)

    def test_simple_transformation(self):
        input = [["hi"], ["hi holden"], ["bye"]]
        expected = [["hi"], ["hi", "holden"], ["bye"]]
        self.run_func(input, SimpleStreamingTest.tokenize, expected)

    def test_noop_transformation(self):
        input = [["hi"], ["hi holden"], ["bye"]]
        self.run_func(input, SimpleStreamingTest.noop, input)


if __name__ == "__main__":
    unittest2.main()

Add a second trivial streaming test to make sure our re-useing the spark context is ok
Add a second trivial streaming test to make sure our re-useing the spark context is ok

  
  """Simple streaming test"""
  
  from sparktestingbase.streamingtestcase import StreamingTestCase
  import unittest2
  
  
  class SimpleStreamingTest(StreamingTestCase):
      """A simple test."""
  
      @classmethod
      def tokenize(cls, f):
          return f.flatMap(lambda line: line.split(" "))
-     
+ 
+     @classmethod
+     def noop(cls, f):
+         return f.map(lambda x: x)
+ 
      def test_simple_transformation(self):
          input = [["hi"], ["hi holden"], ["bye"]]
          expected = [["hi"], ["hi", "holden"], ["bye"]]
          self.run_func(input, SimpleStreamingTest.tokenize, expected)
  
+     def test_noop_transformation(self):
+         input = [["hi"], ["hi holden"], ["bye"]]
+         self.run_func(input, SimpleStreamingTest.noop, input)
+ 
+ 
  if __name__ == "__main__":
      unittest2.main()
  
Add a second trivial streaming test to make sure our re-useing the spark context is ok
## Code Before:

"""Simple streaming test"""

from sparktestingbase.streamingtestcase import StreamingTestCase
import unittest2


class SimpleStreamingTest(StreamingTestCase):
    """A simple test."""

    @classmethod
    def tokenize(cls, f):
        return f.flatMap(lambda line: line.split(" "))
    
    def test_simple_transformation(self):
        input = [["hi"], ["hi holden"], ["bye"]]
        expected = [["hi"], ["hi", "holden"], ["bye"]]
        self.run_func(input, SimpleStreamingTest.tokenize, expected)

if __name__ == "__main__":
    unittest2.main()

## Instruction:
Add a second trivial streaming test to make sure our re-useing the spark context is ok
## Code After:

"""Simple streaming test"""

from sparktestingbase.streamingtestcase import StreamingTestCase
import unittest2


class SimpleStreamingTest(StreamingTestCase):
    """A simple test."""

    @classmethod
    def tokenize(cls, f):
        return f.flatMap(lambda line: line.split(" "))

    @classmethod
    def noop(cls, f):
        return f.map(lambda x: x)

    def test_simple_transformation(self):
        input = [["hi"], ["hi holden"], ["bye"]]
        expected = [["hi"], ["hi", "holden"], ["bye"]]
        self.run_func(input, SimpleStreamingTest.tokenize, expected)

    def test_noop_transformation(self):
        input = [["hi"], ["hi holden"], ["bye"]]
        self.run_func(input, SimpleStreamingTest.noop, input)


if __name__ == "__main__":
    unittest2.main()
