<s> from __future__ import ( absolute_import , division , generators , nested_scopes , print_function , <EOL> unicode_literals , with_statement ) <EOL> import unittest <EOL> import mock <EOL> from pants . engine . exp . legacy . commands import open_exp_graph <EOL> class GraphInvalidationTest ( unittest . TestCase ) : <EOL> def _make_setup_args ( self , * specs ) : <EOL> options = mock . Mock ( ) <EOL> options . target_specs = specs <EOL> return dict ( options = options ) <EOL> def setup_legacy_product_graph ( self , * specs ) : <EOL> kwargs = self . _make_setup_args ( * specs ) <EOL> with open_exp_graph ( ** kwargs ) as ( _ , _ , scheduler ) : <EOL> return scheduler . product_graph <EOL> def test_invalidate_fsnode ( self ) : <EOL> product_graph = self . setup_legacy_product_graph ( '<STR_LIT>' ) <EOL> initial_node_count = len ( product_graph ) <EOL> self . assertGreater ( initial_node_count , <NUM_LIT:0> ) <EOL> product_graph . invalidate_files ( [ '<STR_LIT>' ] ) <EOL> self . assertLess ( len ( product_graph ) , initial_node_count ) <EOL> def test_invalidate_fsnode_incremental ( self ) : <EOL> product_graph = self . setup_legacy_product_graph ( '<STR_LIT>' ) <EOL> node_count = len ( product_graph ) <EOL> self . assertGreater ( node_count , <NUM_LIT:0> ) <EOL> for filename in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> product_graph . invalidate_files ( [ filename ] ) <EOL> node_count , last_node_count = len ( product_graph ) , node_count <EOL> self . assertLess ( node_count , last_node_count ) </s>
