Ejemplo n.º 1
0
 def test_row_filter_string(self):
     with self.table.unlocked():
         self.table.metas[:, -1] = self.table.metas[::-1, -2]
     val_filter = Values([
         FilterString(None, FilterString.Between, "c", "e")])
     filtered = val_filter(self.table)
     self.assertEqual(list(filtered.metas[:, -2].flatten()), list("cde"))
Ejemplo n.º 2
0
    def test_row_filters_is_defined(self):
        filtered = IsDefined()(self.table)
        self.assertEqual(list(filtered.metas[:, -2].flatten()), list("ab"))

        val_filter = Values([
            FilterContinuous(None, FilterContinuous.IsDefined)])
        filtered = val_filter(self.table)
        self.assertEqual(list(filtered.metas[:, -2].flatten()), list("abdg"))

        val_filter = Values([FilterString(None, FilterString.IsDefined)])
        filtered = val_filter(self.table)
        self.assertEqual(list(filtered.metas[:, -2].flatten()), list("abcdef"))

        val_filter = Values([IsDefined()])
        filtered = val_filter(self.table)
        self.assertEqual(list(filtered.metas[:, -2].flatten()), list("ab"))

        val_filter = Values([IsDefined(negate=True)])
        filtered = val_filter(self.table)
        self.assertEqual(list(filtered.metas[:, -2].flatten()), list("cdefg"))

        val_filter = Values([IsDefined(["c1"])])
        filtered = val_filter(self.table)
        self.assertEqual(list(filtered.metas[:, -2].flatten()), list("abdefg"))

        val_filter = Values([IsDefined(["c1"], negate=True)])
        filtered = val_filter(self.table)
        self.assertEqual(list(filtered.metas[:, -2].flatten()), list("c"))