# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
import unittest
import sys
import dill

import test_functions
from test_utilities import standalone

import numpy as np

from streamsx.topology.topology import *
from streamsx.topology import schema
import streamsx.topology.context

class TestLambdas(unittest.TestCase):

  def test_TopologyLambdaFilter(self):
     topo = Topology("test_TopologyLambdaFilter")
     if topo is not None:
         return None
     hw = topo.source(test_functions.hello_world)
     hwf = hw.filter(lambda t : "Wor" in t)
     hwf.sink(test_functions.check_hello_world_filter)
     standalone(self, topo)

  def test_TopologyLambdaModule(self):
     "Lambda using an imported module"
     topo = Topology("test_TopologyLambdaModule")
     hw = topo.source(test_functions.hello_world)
     hw = hw.map(lambda t: t + ":" +  str(np.cos(0.4)))
     hw = hw.map(lambda t: t.split(":",1)[0])
     hw.sink(test_functions.check_hello_world)
     standalone(self, topo)

# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
import unittest
import sys
import dill

import test_functions
from test_utilities import standalone

import numpy as np

from streamsx.topology.topology import *
from streamsx.topology import schema
import streamsx.topology.context

class TestLambdas(unittest.TestCase):

  def test_TopologyLambdaFilter(self):
     topo = Topology("test_TopologyLambdaFilter")
     hw = topo.source(test_functions.hello_world)
     hwf = hw.filter(lambda t : "Wor" in t)
     hwf.sink(test_functions.check_hello_world_filter)
     standalone(self, topo)

  def test_TopologyLambdaModule(self):
     "Lambda using an imported module"
     topo = Topology("test_TopologyLambdaModule")
     hw = topo.source(test_functions.hello_world)
     hw = hw.map(lambda t: t + ":" +  str(np.cos(0.4)))
     hw = hw.map(lambda t: t.split(":",1)[0])
     hw.sink(test_functions.check_hello_world)
     standalone(self, topo)

Enable test