コード例 #1
0
 def test_complex_query(self):
     self.assertEqual(
         construct_sru_query('srw.kw = "foo"',
                             mat_type="large print",
                             cat_source="DLC"),
         'srw.kw = "foo" AND srw.mt = "lpt" AND srw.pc = "dlc"',
     )
コード例 #2
0
 def test_cat_source_any(self):
     self.assertEqual(construct_sru_query("foo", cat_source="any"), "foo")
コード例 #3
0
 def test_cat_source_dlc(self):
     self.assertEqual(construct_sru_query("foo", cat_source="DLC"),
                      'foo AND srw.pc = "dlc"')
コード例 #4
0
 def test_mat_type_dvd(self):
     self.assertEqual(construct_sru_query("foo", mat_type="dvd"),
                      'foo AND srw.mt = "dvv"')
コード例 #5
0
 def test_mat_type_bluray(self):
     self.assertEqual(construct_sru_query("foo", mat_type="bluray"),
                      'foo AND srw.mt = "bta"')
コード例 #6
0
 def test_mat_type_any(self):
     self.assertEqual(construct_sru_query("foo", mat_type="any"), "foo")
コード例 #7
0
 def test_mat_type_large_print(self):
     self.assertEqual(construct_sru_query("foo", mat_type="large print"),
                      'foo AND srw.mt = "lpt"')
コード例 #8
0
 def test_keyword_type_lccn(self):
     self.assertEqual(construct_sru_query("1234", keyword_type="LCCN"),
                      'srw.dn = "1234"')
コード例 #9
0
 def test_keyword_type_oclc_no(self):
     self.assertEqual(construct_sru_query("1234", keyword_type="OCLC #"),
                      'srw.no = "1234"')
コード例 #10
0
 def test_keyword_type_issn(self):
     self.assertEqual(construct_sru_query("1234", keyword_type="ISSN"),
                      'srw.in = "1234"')
コード例 #11
0
 def test_keyword_type_upc(self):
     self.assertEqual(construct_sru_query("1234", keyword_type="UPC"),
                      'srw.sn = "1234"')
コード例 #12
0
 def test_keyword_none(self):
     with self.assertRaises(TypeError):
         construct_sru_query(None)