<s> """<STR_LIT>""" <EOL> import datetime <EOL> import h . test . factories as factories <EOL> class TestAnnotation ( object ) : <EOL> """<STR_LIT>""" <EOL> def test_id ( self ) : <EOL> """<STR_LIT>""" <EOL> annotation_1 = factories . Annotation ( ) <EOL> annotation_2 = factories . Annotation ( ) <EOL> assert annotation_1 . get ( "<STR_LIT:id>" ) <EOL> assert annotation_2 . get ( "<STR_LIT:id>" ) <EOL> assert annotation_1 [ "<STR_LIT:id>" ] != annotation_2 [ "<STR_LIT:id>" ] <EOL> def test_text ( self ) : <EOL> """<STR_LIT>""" <EOL> annotation_1 = factories . Annotation ( ) <EOL> annotation_2 = factories . Annotation ( ) <EOL> assert annotation_1 . get ( "<STR_LIT:text>" ) <EOL> assert annotation_2 . get ( "<STR_LIT:text>" ) <EOL> assert annotation_1 [ "<STR_LIT:text>" ] != annotation_2 [ "<STR_LIT:text>" ] <EOL> def test_custom_user ( self ) : <EOL> """<STR_LIT>""" <EOL> annotation = factories . Annotation ( username = "<STR_LIT>" ) <EOL> assert "<STR_LIT>" in annotation [ "<STR_LIT:user>" ] <EOL> assert "<STR_LIT:username>" not in annotation <EOL> def test_created_date ( self ) : <EOL> """<STR_LIT>""" <EOL> before = datetime . datetime . now ( ) <EOL> annotation = factories . Annotation ( ) <EOL> after = datetime . datetime . now ( ) <EOL> created = datetime . datetime . strptime ( <EOL> annotation [ "<STR_LIT>" ] , "<STR_LIT>" ) <EOL> assert before < created < after <EOL> def test_updated_date ( self ) : <EOL> """<STR_LIT>""" <EOL> before = datetime . datetime . now ( ) <EOL> annotation = factories . Annotation ( ) <EOL> after = datetime . datetime . now ( ) <EOL> updated = datetime . datetime . strptime ( <EOL> annotation [ "<STR_LIT>" ] , "<STR_LIT>" ) <EOL> assert before < updated < after <EOL> def test_tags ( self ) : <EOL> """<STR_LIT>""" <EOL> annotation = factories . Annotation ( num_tags = <NUM_LIT:20> ) <EOL> assert len ( annotation [ "<STR_LIT>" ] ) == <NUM_LIT:20> <EOL> assert "<STR_LIT>" not in annotation <EOL> def test_custom_tags ( self ) : <EOL> assert factories . Annotation ( tags = [ "<STR_LIT:foo>" , "<STR_LIT:bar>" , "<STR_LIT>" ] ) [ "<STR_LIT>" ] == [ <EOL> "<STR_LIT:foo>" , "<STR_LIT:bar>" , "<STR_LIT>" ] <EOL> def test_uri ( self ) : <EOL> annotation = factories . Annotation ( random_number = <NUM_LIT:3> ) <EOL> assert annotation [ "<STR_LIT>" ] == "<STR_LIT>" <EOL> assert "<STR_LIT>" not in annotation <EOL> def test_source ( self ) : <EOL> annotation = factories . Annotation ( random_number = <NUM_LIT:3> ) <EOL> assert annotation [ "<STR_LIT:target>" ] [ <NUM_LIT:0> ] [ "<STR_LIT:source>" ] == ( <EOL> "<STR_LIT>" ) <EOL> def test_permissions ( self ) : <EOL> annotation = factories . Annotation ( username = "<STR_LIT>" ) <EOL> assert "<STR_LIT>" in annotation [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ <NUM_LIT:0> ] <EOL> assert "<STR_LIT>" in annotation [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ <NUM_LIT:0> ] <EOL> assert "<STR_LIT>" in annotation [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ <NUM_LIT:0> ] <EOL> def test_document_title ( self ) : <EOL> assert factories . Annotation ( random_number = <NUM_LIT:30> ) [ "<STR_LIT>" ] [ "<STR_LIT:title>" ] == ( <EOL> "<STR_LIT>" ) <EOL> def test_document_link ( self ) : <EOL> annotation = factories . Annotation ( random_number = <NUM_LIT:30> ) <EOL> assert annotation [ "<STR_LIT>" ] [ "<STR_LIT>" ] [ <NUM_LIT:0> ] [ "<STR_LIT>" ] == ( <EOL> "<STR_LIT>" ) </s>
