<s> """<STR_LIT>""" <EOL> import os <EOL> import signal <EOL> import unittest <EOL> from unittest . mock import patch <EOL> import time <EOL> import threading <EOL> from datetime import datetime , timedelta <EOL> import pytz <EOL> import homeassistant . core as ha <EOL> from homeassistant . exceptions import ( <EOL> HomeAssistantError , InvalidEntityFormatError ) <EOL> import homeassistant . util . dt as dt_util <EOL> from homeassistant . const import ( <EOL> __version__ , EVENT_HOMEASSISTANT_START , EVENT_HOMEASSISTANT_STOP , <EOL> EVENT_STATE_CHANGED , ATTR_FRIENDLY_NAME , TEMP_CELSIUS , <EOL> TEMP_FAHRENHEIT ) <EOL> from tests . common import get_test_home_assistant <EOL> PST = pytz . timezone ( '<STR_LIT>' ) <EOL> class TestHomeAssistant ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> self . hass = get_test_home_assistant ( ) <EOL> self . hass . states . set ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . hass . states . set ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> def tearDown ( self ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> self . hass . stop ( ) <EOL> except HomeAssistantError : <EOL> pass <EOL> def test_start ( self ) : <EOL> """<STR_LIT>""" <EOL> calls = [ ] <EOL> self . hass . bus . listen_once ( EVENT_HOMEASSISTANT_START , <EOL> lambda event : calls . append ( <NUM_LIT:1> ) ) <EOL> self . hass . start ( ) <EOL> self . hass . pool . block_till_done ( ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( calls ) ) <EOL> def test_block_till_stoped ( self ) : <EOL> """<STR_LIT>""" <EOL> with patch ( '<STR_LIT>' ) : <EOL> blocking_thread = threading . Thread ( <EOL> target = self . hass . block_till_stopped ) <EOL> self . assertFalse ( blocking_thread . is_alive ( ) ) <EOL> blocking_thread . start ( ) <EOL> self . assertTrue ( blocking_thread . is_alive ( ) ) <EOL> self . hass . services . call ( ha . DOMAIN , ha . SERVICE_HOMEASSISTANT_STOP ) <EOL> self . hass . pool . block_till_done ( ) <EOL> for _ in range ( <NUM_LIT:20> ) : <EOL> if not blocking_thread . is_alive ( ) : <EOL> break <EOL> time . sleep ( <NUM_LIT> ) <EOL> self . assertFalse ( blocking_thread . is_alive ( ) ) <EOL> def test_stopping_with_sigterm ( self ) : <EOL> """<STR_LIT>""" <EOL> calls = [ ] <EOL> self . hass . bus . listen_once ( EVENT_HOMEASSISTANT_STOP , <EOL> lambda event : calls . append ( <NUM_LIT:1> ) ) <EOL> def send_sigterm ( length ) : <EOL> """<STR_LIT>""" <EOL> os . kill ( os . getpid ( ) , signal . SIGTERM ) <EOL> with patch ( '<STR_LIT>' , send_sigterm ) : <EOL> self . hass . block_till_stopped ( ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( calls ) ) <EOL> class TestEvent ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_eq ( self ) : <EOL> """<STR_LIT>""" <EOL> now = dt_util . utcnow ( ) <EOL> data = { '<STR_LIT>' : '<STR_LIT>' } <EOL> event1 , event2 = [ <EOL> ha . Event ( '<STR_LIT>' , data , time_fired = now ) <EOL> for _ in range ( <NUM_LIT:2> ) <EOL> ] <EOL> self . assertEqual ( event1 , event2 ) <EOL> def test_repr ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , <EOL> str ( ha . Event ( "<STR_LIT>" ) ) ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , <EOL> str ( ha . Event ( "<STR_LIT>" , <EOL> { "<STR_LIT>" : "<STR_LIT>" } , <EOL> ha . EventOrigin . remote ) ) ) <EOL> def test_as_dict ( self ) : <EOL> """<STR_LIT>""" <EOL> event_type = '<STR_LIT>' <EOL> now = dt_util . utcnow ( ) <EOL> data = { '<STR_LIT>' : '<STR_LIT>' } <EOL> event = ha . Event ( event_type , data , ha . EventOrigin . local , now ) <EOL> expected = { <EOL> '<STR_LIT>' : event_type , <EOL> '<STR_LIT:data>' : data , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : now , <EOL> } <EOL> self . assertEqual ( expected , event . as_dict ( ) ) <EOL> class TestEventBus ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> self . bus = ha . EventBus ( ha . create_worker_pool ( <NUM_LIT:0> ) ) <EOL> self . bus . listen ( '<STR_LIT>' , lambda x : len ) <EOL> def tearDown ( self ) : <EOL> """<STR_LIT>""" <EOL> self . bus . _pool . stop ( ) <EOL> def test_add_remove_listener ( self ) : <EOL> """<STR_LIT>""" <EOL> self . bus . _pool . add_worker ( ) <EOL> old_count = len ( self . bus . listeners ) <EOL> def listener ( _ ) : pass <EOL> self . bus . listen ( '<STR_LIT:test>' , listener ) <EOL> self . assertEqual ( old_count + <NUM_LIT:1> , len ( self . bus . listeners ) ) <EOL> self . bus . remove_listener ( '<STR_LIT:test>' , lambda x : len ) <EOL> self . bus . remove_listener ( '<STR_LIT:test>' , listener ) <EOL> self . assertEqual ( old_count , len ( self . bus . listeners ) ) <EOL> self . bus . remove_listener ( '<STR_LIT:test>' , listener ) <EOL> def test_listen_once_event ( self ) : <EOL> """<STR_LIT>""" <EOL> runs = [ ] <EOL> self . bus . listen_once ( '<STR_LIT>' , lambda x : runs . append ( <NUM_LIT:1> ) ) <EOL> self . bus . fire ( '<STR_LIT>' ) <EOL> self . bus . fire ( '<STR_LIT>' ) <EOL> self . bus . _pool . add_worker ( ) <EOL> self . bus . _pool . block_till_done ( ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( runs ) ) <EOL> class TestState ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_init ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( <EOL> InvalidEntityFormatError , ha . State , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_domain ( self ) : <EOL> """<STR_LIT>""" <EOL> state = ha . State ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' , state . domain ) <EOL> def test_object_id ( self ) : <EOL> """<STR_LIT>""" <EOL> state = ha . State ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT:hello>' , state . object_id ) <EOL> def test_name_if_no_friendly_name_attr ( self ) : <EOL> """<STR_LIT>""" <EOL> state = ha . State ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' , state . name ) <EOL> def test_name_if_friendly_name_attr ( self ) : <EOL> """<STR_LIT>""" <EOL> name = '<STR_LIT>' <EOL> state = ha . State ( '<STR_LIT>' , '<STR_LIT>' , <EOL> { ATTR_FRIENDLY_NAME : name } ) <EOL> self . assertEqual ( name , state . name ) <EOL> def test_dict_conversion ( self ) : <EOL> """<STR_LIT>""" <EOL> state = ha . State ( '<STR_LIT>' , '<STR_LIT>' , { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( state , ha . State . from_dict ( state . as_dict ( ) ) ) <EOL> def test_dict_conversion_with_wrong_data ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertIsNone ( ha . State . from_dict ( None ) ) <EOL> self . assertIsNone ( ha . State . from_dict ( { '<STR_LIT:state>' : '<STR_LIT:yes>' } ) ) <EOL> self . assertIsNone ( ha . State . from_dict ( { '<STR_LIT>' : '<STR_LIT:yes>' } ) ) <EOL> def test_repr ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( "<STR_LIT>" , <EOL> str ( ha . State ( <EOL> "<STR_LIT>" , "<STR_LIT>" , <EOL> last_changed = datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:8> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:0> ) ) ) ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> str ( ha . State ( "<STR_LIT>" , "<STR_LIT>" , { "<STR_LIT>" : <NUM_LIT> } , <EOL> datetime ( <NUM_LIT> , <NUM_LIT:12> , <NUM_LIT:8> , <NUM_LIT:12> , <NUM_LIT:0> , <NUM_LIT:0> ) ) ) ) <EOL> class TestStateMachine ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> self . pool = ha . create_worker_pool ( <NUM_LIT:0> ) <EOL> self . bus = ha . EventBus ( self . pool ) <EOL> self . states = ha . StateMachine ( self . bus ) <EOL> self . states . set ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . states . set ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> def tearDown ( self ) : <EOL> """<STR_LIT>""" <EOL> self . pool . stop ( ) <EOL> def test_is_state ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertTrue ( self . states . is_state ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertFalse ( self . states . is_state ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertFalse ( self . states . is_state ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def test_is_state_attr ( self ) : <EOL> """<STR_LIT>""" <EOL> self . states . set ( "<STR_LIT>" , "<STR_LIT>" , { "<STR_LIT>" : <NUM_LIT:100> } ) <EOL> self . assertTrue ( <EOL> self . states . is_state_attr ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:100> ) ) <EOL> self . assertFalse ( <EOL> self . states . is_state_attr ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:200> ) ) <EOL> self . assertFalse ( <EOL> self . states . is_state_attr ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertFalse ( <EOL> self . states . is_state_attr ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:100> ) ) <EOL> def test_entity_ids ( self ) : <EOL> """<STR_LIT>""" <EOL> ent_ids = self . states . entity_ids ( ) <EOL> self . assertEqual ( <NUM_LIT:2> , len ( ent_ids ) ) <EOL> self . assertTrue ( '<STR_LIT>' in ent_ids ) <EOL> self . assertTrue ( '<STR_LIT>' in ent_ids ) <EOL> ent_ids = self . states . entity_ids ( '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( ent_ids ) ) <EOL> self . assertTrue ( '<STR_LIT>' in ent_ids ) <EOL> def test_all ( self ) : <EOL> """<STR_LIT>""" <EOL> states = sorted ( state . entity_id for state in self . states . all ( ) ) <EOL> self . assertEqual ( [ '<STR_LIT>' , '<STR_LIT>' ] , states ) <EOL> def test_remove ( self ) : <EOL> """<STR_LIT>""" <EOL> self . pool . add_worker ( ) <EOL> events = [ ] <EOL> self . bus . listen ( EVENT_STATE_CHANGED , <EOL> lambda event : events . append ( event ) ) <EOL> self . assertIn ( '<STR_LIT>' , self . states . entity_ids ( ) ) <EOL> self . assertTrue ( self . states . remove ( '<STR_LIT>' ) ) <EOL> self . pool . block_till_done ( ) <EOL> self . assertNotIn ( '<STR_LIT>' , self . states . entity_ids ( ) ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( events ) ) <EOL> self . assertEqual ( '<STR_LIT>' , events [ <NUM_LIT:0> ] . data . get ( '<STR_LIT>' ) ) <EOL> self . assertIsNotNone ( events [ <NUM_LIT:0> ] . data . get ( '<STR_LIT>' ) ) <EOL> self . assertEqual ( '<STR_LIT>' , events [ <NUM_LIT:0> ] . data [ '<STR_LIT>' ] . entity_id ) <EOL> self . assertIsNone ( events [ <NUM_LIT:0> ] . data . get ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( self . states . remove ( '<STR_LIT>' ) ) <EOL> self . pool . block_till_done ( ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( events ) ) <EOL> def test_case_insensitivty ( self ) : <EOL> """<STR_LIT>""" <EOL> self . pool . add_worker ( ) <EOL> runs = [ ] <EOL> self . bus . listen ( EVENT_STATE_CHANGED , lambda event : runs . append ( event ) ) <EOL> self . states . set ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . bus . _pool . block_till_done ( ) <EOL> self . assertTrue ( self . states . is_state ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( runs ) ) <EOL> def test_last_changed_not_updated_on_same_state ( self ) : <EOL> """<STR_LIT>""" <EOL> state = self . states . get ( '<STR_LIT>' ) <EOL> future = dt_util . utcnow ( ) + timedelta ( hours = <NUM_LIT:10> ) <EOL> with patch ( '<STR_LIT>' , return_value = future ) : <EOL> self . states . set ( "<STR_LIT>" , "<STR_LIT>" , { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( state . last_changed , <EOL> self . states . get ( '<STR_LIT>' ) . last_changed ) <EOL> class TestServiceCall ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_repr ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , <EOL> str ( ha . ServiceCall ( '<STR_LIT>' , '<STR_LIT:start>' ) ) ) <EOL> self . assertEqual ( <EOL> "<STR_LIT>" , <EOL> str ( ha . ServiceCall ( '<STR_LIT>' , '<STR_LIT:start>' , { "<STR_LIT>" : "<STR_LIT:yes>" } ) ) ) <EOL> class TestServiceRegistry ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> self . pool = ha . create_worker_pool ( <NUM_LIT:0> ) <EOL> self . bus = ha . EventBus ( self . pool ) <EOL> self . services = ha . ServiceRegistry ( self . bus , self . pool ) <EOL> self . services . register ( "<STR_LIT>" , "<STR_LIT>" , lambda x : None ) <EOL> def tearDown ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . pool . worker_count : <EOL> self . pool . stop ( ) <EOL> def test_has_service ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertTrue ( <EOL> self . services . has_service ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . assertFalse ( <EOL> self . services . has_service ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> self . assertFalse ( <EOL> self . services . has_service ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> def test_services ( self ) : <EOL> """<STR_LIT>""" <EOL> expected = { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:description>' : '<STR_LIT>' , '<STR_LIT>' : { } } } <EOL> } <EOL> self . assertEqual ( expected , self . services . services ) <EOL> def test_call_with_blocking_done_in_time ( self ) : <EOL> """<STR_LIT>""" <EOL> self . pool . add_worker ( ) <EOL> self . pool . add_worker ( ) <EOL> calls = [ ] <EOL> self . services . register ( "<STR_LIT>" , "<STR_LIT>" , <EOL> lambda x : calls . append ( <NUM_LIT:1> ) ) <EOL> self . assertTrue ( <EOL> self . services . call ( '<STR_LIT>' , '<STR_LIT>' , blocking = True ) ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( calls ) ) <EOL> def test_call_with_blocking_not_done_in_time ( self ) : <EOL> """<STR_LIT>""" <EOL> calls = [ ] <EOL> self . services . register ( "<STR_LIT>" , "<STR_LIT>" , <EOL> lambda x : calls . append ( <NUM_LIT:1> ) ) <EOL> orig_limit = ha . SERVICE_CALL_LIMIT <EOL> ha . SERVICE_CALL_LIMIT = <NUM_LIT> <EOL> self . assertFalse ( <EOL> self . services . call ( '<STR_LIT>' , '<STR_LIT>' , blocking = True ) ) <EOL> self . assertEqual ( <NUM_LIT:0> , len ( calls ) ) <EOL> ha . SERVICE_CALL_LIMIT = orig_limit <EOL> def test_call_non_existing_with_blocking ( self ) : <EOL> """<STR_LIT>""" <EOL> self . pool . add_worker ( ) <EOL> self . pool . add_worker ( ) <EOL> orig_limit = ha . SERVICE_CALL_LIMIT <EOL> ha . SERVICE_CALL_LIMIT = <NUM_LIT> <EOL> self . assertFalse ( <EOL> self . services . call ( '<STR_LIT>' , '<STR_LIT>' , blocking = True ) ) <EOL> ha . SERVICE_CALL_LIMIT = orig_limit <EOL> class TestConfig ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> self . config = ha . Config ( ) <EOL> def test_config_dir_set_correct ( self ) : <EOL> """<STR_LIT>""" <EOL> data_dir = os . getenv ( '<STR_LIT>' ) if os . name == "<STR_LIT>" else os . path . expanduser ( '<STR_LIT>' ) <EOL> self . assertEqual ( os . path . join ( data_dir , "<STR_LIT>" ) , <EOL> self . config . config_dir ) <EOL> def test_path_with_file ( self ) : <EOL> """<STR_LIT>""" <EOL> data_dir = os . getenv ( '<STR_LIT>' ) if os . name == "<STR_LIT>" else os . path . expanduser ( '<STR_LIT>' ) <EOL> self . assertEqual ( os . path . join ( data_dir , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . config . path ( "<STR_LIT>" ) ) <EOL> def test_path_with_dir_and_file ( self ) : <EOL> """<STR_LIT>""" <EOL> data_dir = os . getenv ( '<STR_LIT>' ) if os . name == "<STR_LIT>" else os . path . expanduser ( '<STR_LIT>' ) <EOL> self . assertEqual ( <EOL> os . path . join ( data_dir , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> self . config . path ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> def test_temperature_not_convert_if_no_preference ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( <EOL> ( <NUM_LIT> , TEMP_CELSIUS ) , <EOL> self . config . temperature ( <NUM_LIT> , TEMP_CELSIUS ) ) <EOL> self . assertEqual ( <EOL> ( <NUM_LIT> , TEMP_FAHRENHEIT ) , <EOL> self . config . temperature ( <NUM_LIT> , TEMP_FAHRENHEIT ) ) <EOL> def test_temperature_not_convert_if_invalid_value ( self ) : <EOL> """<STR_LIT>""" <EOL> self . config . temperature_unit = TEMP_FAHRENHEIT <EOL> self . assertEqual ( <EOL> ( '<STR_LIT>' , TEMP_CELSIUS ) , <EOL> self . config . temperature ( '<STR_LIT>' , TEMP_CELSIUS ) ) <EOL> def test_temperature_not_convert_if_invalid_unit ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( <EOL> ( <NUM_LIT> , '<STR_LIT>' ) , <EOL> self . config . temperature ( <NUM_LIT> , '<STR_LIT>' ) ) <EOL> def test_temperature_to_convert_to_celsius ( self ) : <EOL> """<STR_LIT>""" <EOL> self . config . temperature_unit = TEMP_CELSIUS <EOL> self . assertEqual ( <EOL> ( <NUM_LIT> , TEMP_CELSIUS ) , <EOL> self . config . temperature ( <NUM_LIT> , TEMP_CELSIUS ) ) <EOL> self . assertEqual ( <EOL> ( <NUM_LIT> , TEMP_CELSIUS ) , <EOL> self . config . temperature ( <NUM_LIT> , TEMP_FAHRENHEIT ) ) <EOL> def test_temperature_to_convert_to_fahrenheit ( self ) : <EOL> """<STR_LIT>""" <EOL> self . config . temperature_unit = TEMP_FAHRENHEIT <EOL> self . assertEqual ( <EOL> ( <NUM_LIT> , TEMP_FAHRENHEIT ) , <EOL> self . config . temperature ( <NUM_LIT> , TEMP_CELSIUS ) ) <EOL> self . assertEqual ( <EOL> ( <NUM_LIT> , TEMP_FAHRENHEIT ) , <EOL> self . config . temperature ( <NUM_LIT> , TEMP_FAHRENHEIT ) ) <EOL> def test_as_dict ( self ) : <EOL> """<STR_LIT>""" <EOL> expected = { <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT:version>' : __version__ , <EOL> } <EOL> self . assertEqual ( expected , self . config . as_dict ( ) ) <EOL> class TestWorkerPool ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_exception_during_job ( self ) : <EOL> """<STR_LIT>""" <EOL> pool = ha . create_worker_pool ( <NUM_LIT:1> ) <EOL> def malicious_job ( _ ) : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> calls = [ ] <EOL> def register_call ( _ ) : <EOL> calls . append ( <NUM_LIT:1> ) <EOL> pool . add_job ( ha . JobPriority . EVENT_DEFAULT , ( malicious_job , None ) ) <EOL> pool . add_job ( ha . JobPriority . EVENT_DEFAULT , ( register_call , None ) ) <EOL> pool . block_till_done ( ) <EOL> self . assertEqual ( <NUM_LIT:1> , len ( calls ) ) </s>
