<s> from unittest import TestCase , TestSuite , main , makeSuite <EOL> from fakeclient import FakeClient , GranularityFakeClient , TestError <EOL> import os <EOL> from datetime import datetime <EOL> from oaipmh import metadata <EOL> directory = os . path . dirname ( __file__ ) <EOL> fake8 = os . path . join ( directory , '<STR_LIT>' ) <EOL> fakeclient = FakeClient ( fake8 ) <EOL> oai_dc_lang_reader = metadata . MetadataReader ( <EOL> fields = metadata . oai_dc_reader . _fields , <EOL> namespaces = metadata . oai_dc_reader . _namespaces , <EOL> flags = [ '<STR_LIT>' ] <EOL> ) <EOL> fakeclient . getMetadataRegistry ( ) . registerReader ( <EOL> '<STR_LIT>' , metadata . oai_dc_reader ) <EOL> class LangTestCase ( TestCase ) : <EOL> def test_lang_absent ( self ) : <EOL> records = fakeclient . listRecords ( from_ = datetime ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT:10> ) , <EOL> metadataPrefix = '<STR_LIT>' ) <EOL> records = list ( records ) <EOL> header , metadata , about = records [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> m = metadata . _map <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assert_ ( m . has_key ( '<STR_LIT>' ) ) <EOL> def test_lang_present ( self ) : <EOL> fakeclient . getMetadataRegistry ( ) . registerReader ( <EOL> '<STR_LIT>' , oai_dc_lang_reader ) <EOL> records = fakeclient . listRecords ( from_ = datetime ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT:11> ) , <EOL> metadataPrefix = '<STR_LIT>' ) <EOL> records = list ( records ) <EOL> header , metadata , about = records [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> m = metadata . _map <EOL> self . assert_ ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assert_ ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assert_ ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assert_ ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assert_ ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assert_ ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assert_ ( m . has_key ( '<STR_LIT>' ) ) <EOL> def test_lang_ignored_absent ( self ) : <EOL> records = fakeclient . listRecords ( from_ = datetime ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT:10> ) , <EOL> metadataPrefix = '<STR_LIT>' ) <EOL> records = list ( records ) <EOL> header , metadata , about = records [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> m = metadata . _map <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assert_ ( m . has_key ( '<STR_LIT>' ) ) <EOL> def test_lang_ignored_present ( self ) : <EOL> records = fakeclient . listRecords ( from_ = datetime ( <NUM_LIT> , <NUM_LIT:0> <NUM_LIT:4> , <NUM_LIT:11> ) , <EOL> metadataPrefix = '<STR_LIT>' ) <EOL> records = list ( records ) <EOL> header , metadata , about = records [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> m = metadata . _map <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assertFalse ( m . has_key ( '<STR_LIT>' ) ) <EOL> self . assert_ ( m . has_key ( '<STR_LIT>' ) ) <EOL> def test_suite ( ) : <EOL> return TestSuite ( ( makeSuite ( LangTestCase ) , ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( defaultTest = '<STR_LIT>' ) </s>
