<s> from __future__ import print_function <EOL> import datetime <EOL> from helpers import unittest <EOL> import luigi <EOL> import luigi . interface <EOL> from luigi . mock import MockTarget <EOL> class Popularity ( luigi . Task ) : <EOL> date = luigi . DateParameter ( default = datetime . date . today ( ) - datetime . timedelta ( <NUM_LIT:1> ) ) <EOL> def output ( self ) : <EOL> return MockTarget ( '<STR_LIT>' % self . date . strftime ( '<STR_LIT>' ) ) <EOL> def requires ( self ) : <EOL> return Popularity ( self . date - datetime . timedelta ( <NUM_LIT:1> ) ) <EOL> def run ( self ) : <EOL> f = self . output ( ) . open ( '<STR_LIT:w>' ) <EOL> for line in self . input ( ) . open ( '<STR_LIT:r>' ) : <EOL> print ( int ( line . strip ( ) ) + <NUM_LIT:1> , file = f ) <EOL> f . close ( ) <EOL> class RecursionTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> MockTarget . fs . get_all_data ( ) [ '<STR_LIT>' ] = b'<STR_LIT>' <EOL> def test_invoke ( self ) : <EOL> luigi . build ( [ Popularity ( datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:5> ) ) ] , local_scheduler = True ) <EOL> self . assertEqual ( MockTarget . fs . get_data ( '<STR_LIT>' ) , b'<STR_LIT>' ) </s>
