old_contents: # Tai Sakuma <tai.sakuma@gmail.com>
  from alphatwirl.selection.factories.LambdaStrFactory import LambdaStrFactory
  import unittest
  
  ##__________________________________________________________________||
  class MockLambdaStr(object):
      def __init__(self, lambda_str, name = None):
          self.name = name
          self.lambda_str = lambda_str
  
  ##__________________________________________________________________||
  class Test_LambdaStrFactory(unittest.TestCase):
  
      def test_standard(self):
          obj = LambdaStrFactory(
              lambda_str = 'ev : ev.var1[0] >= 10',
              name = 'var1',
              LambdaStrClass = MockLambdaStr
          )
          self.assertIsInstance(obj, MockLambdaStr)
          self.assertEqual('ev : ev.var1[0] >= 10', obj.lambda_str)
          self.assertEqual('var1', obj.name)
  
      def test_no_name(self):
          obj = LambdaStrFactory(
              lambda_str = 'ev : ev.var1[0] >= 10',
              LambdaStrClass = MockLambdaStr
          )
          self.assertIsInstance(obj, MockLambdaStr)
          self.assertEqual('ev : ev.var1[0] >= 10', obj.lambda_str)
          self.assertEqual(None, obj.name)
  
      def test_format(self):
          obj = LambdaStrFactory(
              lambda_str = 'ev : {low} <= ev.var1[0] = {high}',
              name = 'var1',
              low = 100,
              high = 200,
              LambdaStrClass = MockLambdaStr
          )
          self.assertIsInstance(obj, MockLambdaStr)
          self.assertEqual('ev : 100 <= ev.var1[0] = 200', obj.lambda_str)
          self.assertEqual('var1', obj.name)
  
  ##__________________________________________________________________||
  
new_contents: # Tai Sakuma <tai.sakuma@gmail.com>
  import pytest
  
  try:
      import unittest.mock as mock
  except ImportError:
      import mock
  
  from alphatwirl.selection.factories.LambdaStrFactory import LambdaStrFactory
  
  ##__________________________________________________________________||
  @pytest.fixture()
  def MockLambdaStr():
      return mock.Mock()
  
  @pytest.mark.parametrize('kwargs, expected', [
      pytest.param(
          dict(
              lambda_str='ev : ev.var1[0] >= 10',
              name='var1',
          ),
          dict(
              lambda_str='ev : ev.var1[0] >= 10',
              name='var1'
          ),
          id='simple',
      ),
      pytest.param(
          dict(
              lambda_str='ev : ev.var1[0] >= 10',
          ),
          dict(
              lambda_str='ev : ev.var1[0] >= 10',
              name=None,
          ),
          id='no-name',
      ),
      pytest.param(
          dict(
              lambda_str = 'ev : {low} <= ev.var1[0] = {high}',
              name='var1', low=100, high=200,
          ),
          dict(
              lambda_str = 'ev : 100 <= ev.var1[0] = 200',
              name='var1'
          ),
          id='format',
      ),
  ])
  def test_call(kwargs, expected, MockLambdaStr):
      actual = LambdaStrFactory(LambdaStrClass=MockLambdaStr, **kwargs)
      assert [mock.call(**expected)] == MockLambdaStr.call_args_list
      assert actual == MockLambdaStr()
  
  ##__________________________________________________________________||
  
subject: rewrite test for LambdaStrFactory with pytest