<s> from . . import unittest <EOL> from synapse . util . wheel_timer import WheelTimer <EOL> class WheelTimerTestCase ( unittest . TestCase ) : <EOL> def test_single_insert_fetch ( self ) : <EOL> wheel = WheelTimer ( bucket_size = <NUM_LIT:5> ) <EOL> obj = object ( ) <EOL> wheel . insert ( <NUM_LIT:100> , obj , <NUM_LIT> ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ obj ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> def test_mutli_insert ( self ) : <EOL> wheel = WheelTimer ( bucket_size = <NUM_LIT:5> ) <EOL> obj1 = object ( ) <EOL> obj2 = object ( ) <EOL> obj3 = object ( ) <EOL> wheel . insert ( <NUM_LIT:100> , obj1 , <NUM_LIT> ) <EOL> wheel . insert ( <NUM_LIT> , obj2 , <NUM_LIT> ) <EOL> wheel . insert ( <NUM_LIT> , obj3 , <NUM_LIT> ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ obj2 ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ obj1 ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT:200> ) , [ obj3 ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> def test_insert_past ( self ) : <EOL> wheel = WheelTimer ( bucket_size = <NUM_LIT:5> ) <EOL> obj = object ( ) <EOL> wheel . insert ( <NUM_LIT:100> , obj , <NUM_LIT:50> ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ obj ] ) <EOL> def test_insert_past_mutli ( self ) : <EOL> wheel = WheelTimer ( bucket_size = <NUM_LIT:5> ) <EOL> obj1 = object ( ) <EOL> obj2 = object ( ) <EOL> obj3 = object ( ) <EOL> wheel . insert ( <NUM_LIT:100> , obj1 , <NUM_LIT> ) <EOL> wheel . insert ( <NUM_LIT:100> , obj2 , <NUM_LIT> ) <EOL> wheel . insert ( <NUM_LIT:100> , obj3 , <NUM_LIT:50> ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ obj3 ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ obj2 ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT:200> ) , [ obj1 ] ) <EOL> self . assertListEqual ( wheel . fetch ( <NUM_LIT> ) , [ ] ) </s>
