Esempio n. 1
0
 def test_get_unique_rows(self):
     result = get_unique_rows(STOCKS_CAT)
     expected = np.array([
         ['tel', 'USA'],
         ['tel', 'CN'],
         ['nrg', 'USA'],
         ['nrg', 'NL'],
         ['tech', 'USA'],
         ['cons', 'USA'],
         ['fin', 'USA'],
     ])
     # Check if each row is found exactly 1 time.
     for row in expected:
         mask = result == row
         matches = np.where(np.all(mask, axis=1))
         self.assertEqual(len(matches), 1)
Esempio n. 2
0
 def test_get_unique_rows(self):
     result = get_unique_rows(STOCKS_CAT)
     expected = np.array([
         ['tel', 'USA'],
         ['tel', 'CN'],
         ['nrg', 'USA'],
         ['nrg', 'NL'],
         ['tech', 'USA'],
         ['cons', 'USA'],
         ['fin', 'USA'],
     ])
     # Check if each row is found exactly 1 time.
     for row in expected:
         mask = result == row
         matches = np.where(np.all(mask, axis=1))
         self.assertEqual(len(matches), 1)