<s> from __future__ import absolute_import , division , print_function <EOL> from mock import patch <EOL> from matplotlib import cm <EOL> from glue . core import Data , DataCollection <EOL> from . . subset_facet import SubsetFacet <EOL> patched_facet = patch ( '<STR_LIT>' ) <EOL> class TestSubsetFacet ( object ) : <EOL> def setup_method ( self , method ) : <EOL> d = Data ( x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> dc = DataCollection ( [ d ] ) <EOL> self . collect = dc <EOL> self . s = dc . new_subset_group ( ) <EOL> def test_limits ( self ) : <EOL> s = SubsetFacet ( self . collect ) <EOL> s . data = self . collect [ <NUM_LIT:0> ] <EOL> s . component = self . collect [ <NUM_LIT:0> ] . id [ '<STR_LIT:x>' ] <EOL> assert s . vmin == <NUM_LIT:1> <EOL> assert s . vmax == <NUM_LIT:3> <EOL> def test_get_set_cmap ( self ) : <EOL> s = SubsetFacet ( self . collect ) <EOL> assert s . cmap is cm . cool <EOL> def test_apply ( self ) : <EOL> with patched_facet as p : <EOL> s = SubsetFacet ( self . collect ) <EOL> s . data = self . collect [ <NUM_LIT:0> ] <EOL> s . component = self . collect [ <NUM_LIT:0> ] . id [ '<STR_LIT:x>' ] <EOL> s . _apply ( ) <EOL> p . assert_called_once_with ( self . collect , s . component , <EOL> lo = <NUM_LIT:1> , hi = <NUM_LIT:3> , <EOL> steps = <NUM_LIT:5> , log = False ) </s>
