Exemplo n.º 1
0
 def test_CAT_callNos_report_for_sheet(self):
     df = reports.shelf2dataframe('temp', 'nypl')
     callNos = reports.report_callNo_issues(df, 'cat')
     sheet_data = reports.callNos_report_for_sheet(callNos)
     self.assertEqual(sheet_data, [[
         self.report_date, 'TEST VENDOR2', 'ven0002', 'b02345678a',
         'TEST CALL B', 'TEST CALL A', None, 'no'
     ]])
Exemplo n.º 2
0
 def test_callNo_issues(self):
     df = reports.shelf2dataframe('temp', 'bpl')
     callNo = reports.report_callNo_issues(df, 'cat')
     self.assertEqual(list(callNo.columns.values), [
         'vendor', 'vendor_id', 'target_id', 'vendor_callNo',
         'target_callNo', 'duplicate bibs'
     ])
     self.assertEqual(callNo.index.tolist(), [2])
Exemplo n.º 3
0
 def test_bpl_dup_report_for_sheet(self):
     df = reports.shelf2dataframe('temp', 'bpl')
     dups = reports.report_dups('BPL', None, df)
     sheet_data = reports.dups_report_for_sheet('BPL', None, 'CAT', dups)
     self.assertEqual(sheet_data, [[
         self.report_date, 'CAT', 'TEST VENDOR5', 'ven0006', 'b00000008a',
         'b00000008a,b00000009a', 'no'
     ]])
Exemplo n.º 4
0
 def test_shelf2dataframe(self):
     df = reports.shelf2dataframe('temp', 'nypl')
     self.assertIsInstance(df, pd.DataFrame)
     self.assertEqual(list(df.columns.values), [
         'action', 'callNo_match', 'inhouse_dups', 'mixed', 'other',
         'target_callNo', 'target_sierraId', 'updated_by_vendor', 'vendor',
         'vendor_callNo', 'vendor_id'
     ])
     self.assertEqual(df.shape, (6, 11))
     # check if replaces empty strings with np.NaN values
     self.assertEqual(df.index[df['mixed'].isnull()].tolist(),
                      [2, 4, 6, 3, 5])
Exemplo n.º 5
0
 def test_create_bpl_stats(self):
     df = reports.shelf2dataframe('temp', 'bpl')
     stats = reports.create_stats('bpl', df)
     self.assertEqual(stats.shape, (5, 5))
     self.assertEqual(stats.columns.tolist(),
                      ['vendor', 'attach', 'insert', 'update', 'total'])
     self.assertEqual(stats.iloc[0]['attach'], 1)
     self.assertEqual(stats.iloc[0]['vendor'], 'TEST VENDOR1')
     self.assertEqual(stats.iloc[0]['insert'], 0)
     self.assertEqual(stats.iloc[0]['update'], 0)
     self.assertEqual(stats.iloc[0]['total'], 1)
     self.assertEqual(stats.iloc[1]['attach'], 0)
     self.assertEqual(stats.iloc[1]['vendor'], 'TEST VENDOR2')
     self.assertEqual(stats.iloc[1]['insert'], 0)
     self.assertEqual(stats.iloc[1]['update'], 1)
     self.assertEqual(stats.iloc[1]['total'], 1)
Exemplo n.º 6
0
 def test_nypl_research_dup_report_for_sheet(self):
     df = reports.shelf2dataframe('temp', 'nypl')
     dups = reports.report_dups('NYPL', 'research', df)
     sheet_data = reports.dups_report_for_sheet('NYPL', 'research', 'ACQ',
                                                dups)
     self.assertEqual(
         sheet_data,
         [[
             self.report_date, 'ACQ', 'TEST VENDOR1', 'ven0001',
             'b01234567a', None, 'b00000003a', 'b00000004a', 'no'
         ],
          [
              self.report_date, 'ACQ', 'TEST VENDOR4', 'ven0004', None,
              None, None, 'b00000006a', 'no action'
          ],
          [
              self.report_date, 'ACQ', 'TEST VENDOR5', 'ven0005', None,
              None, None, 'b00000004a,b00000005a', 'no'
          ],
          [
              self.report_date, 'ACQ', 'TEST VENDOR5', 'ven0006',
              'b00000008a', 'b00000008a,b00000009a', None, None, 'no'
          ]])
Exemplo n.º 7
0
 def test_report_dups(self):
     df = reports.shelf2dataframe('temp', 'nypl')
     dups = reports.report_dups('NYPL', 'branches', df)
     self.assertEqual(dups.index.tolist(), [1, 4, 5, 6])
Exemplo n.º 8
0
 def test_shelf2dataframe_sierra_id_formatting(self):
     df = reports.shelf2dataframe('temp', 'nypl')