<s> from pyvows import Vows , expect <EOL> from thumbor . detectors import BaseDetector <EOL> ctx = Vows . Context <EOL> def get_detector ( name ) : <EOL> class MockDetector : <EOL> def __init__ ( self , context , index , detectors ) : <EOL> self . context = context <EOL> self . index = index <EOL> self . detectors = detectors <EOL> self . name = name <EOL> def detect ( self , callback ) : <EOL> callback ( self . name ) <EOL> return MockDetector <EOL> @ Vows . batch <EOL> class BaseDetectorVows ( ctx ) : <EOL> class CreateInstanceVows ( ctx ) : <EOL> def topic ( self ) : <EOL> return BaseDetector ( "<STR_LIT>" , <NUM_LIT:1> , "<STR_LIT>" ) <EOL> def should_not_be_null ( self , topic ) : <EOL> expect ( topic ) . not_to_be_null ( ) <EOL> expect ( topic ) . not_to_be_an_error ( ) <EOL> class DetectShouldRaise ( ctx ) : <EOL> @ Vows . capture_error <EOL> def topic ( self ) : <EOL> BaseDetector ( "<STR_LIT>" , <NUM_LIT:1> , "<STR_LIT>" ) . detect ( None ) <EOL> def should_be_an_error ( self , topic ) : <EOL> expect ( topic ) . to_be_an_error ( ) <EOL> expect ( topic ) . to_be_an_error_like ( NotImplementedError ) <EOL> class NextVows ( ctx ) : <EOL> @ Vows . async_topic <EOL> def topic ( self , callback ) : <EOL> detector = BaseDetector ( "<STR_LIT>" , <NUM_LIT:0> , [ <EOL> get_detector ( "<STR_LIT:a>" ) , <EOL> get_detector ( "<STR_LIT:b>" ) <EOL> ] ) <EOL> return detector . next ( callback ) <EOL> def should_be_detector_b ( self , topic ) : <EOL> expect ( topic . args [ <NUM_LIT:0> ] ) . to_equal ( "<STR_LIT:b>" ) <EOL> class LastDetectorVows ( ctx ) : <EOL> @ Vows . async_topic <EOL> def topic ( self , callback ) : <EOL> detector = BaseDetector ( "<STR_LIT>" , <NUM_LIT:0> , [ <EOL> get_detector ( "<STR_LIT:a>" ) <EOL> ] ) <EOL> return detector . next ( callback ) <EOL> def should_be_null ( self , topic ) : <EOL> expect ( topic . args ) . to_length ( <NUM_LIT:0> ) </s>
