def test_union(self): import datetime from google.cloud.bigtable.column_family import GCRuleUnion from google.cloud.bigtable.column_family import MaxAgeGCRule from google.cloud.bigtable.column_family import MaxVersionsGCRule rule1 = MaxVersionsGCRule(1) rule2 = MaxAgeGCRule(datetime.timedelta(seconds=1)) orig_rule = GCRuleUnion([rule1, rule2]) gc_rule_pb = orig_rule.to_pb() result = self._call_fut(gc_rule_pb) self.assertIsInstance(result, GCRuleUnion) self.assertEqual(result, orig_rule)
def test_union(self): import datetime from google.cloud.bigtable.column_family import GCRuleUnion from google.cloud.bigtable.column_family import MaxAgeGCRule from google.cloud.bigtable.column_family import MaxVersionsGCRule rule1 = MaxVersionsGCRule(1) rule2 = MaxAgeGCRule(datetime.timedelta(seconds=1)) orig_rule = GCRuleUnion([rule1, rule2]) gc_rule_pb = orig_rule.to_pb() result = self._callFUT(gc_rule_pb) self.assertTrue(isinstance(result, GCRuleUnion)) self.assertEqual(result, orig_rule)
def test__gc_rule_from_pb_union(): import datetime from google.cloud.bigtable.column_family import _gc_rule_from_pb from google.cloud.bigtable.column_family import GCRuleUnion from google.cloud.bigtable.column_family import MaxAgeGCRule from google.cloud.bigtable.column_family import MaxVersionsGCRule rule1 = MaxVersionsGCRule(1) rule2 = MaxAgeGCRule(datetime.timedelta(seconds=1)) orig_rule = GCRuleUnion([rule1, rule2]) gc_rule_pb = orig_rule.to_pb() result = _gc_rule_from_pb(gc_rule_pb) assert isinstance(result, GCRuleUnion) assert result == orig_rule
def test_with_gc_rule_union(self): from google.cloud.bigtable.column_family import GCRuleUnion gc_rule = GCRuleUnion(rules=[]) result = self._call_fut(gc_rule) self.assertTrue(result is gc_rule)
def _make_gc_rule_union(*args, **kwargs): from google.cloud.bigtable.column_family import GCRuleUnion return GCRuleUnion(*args, **kwargs)