def test_max_num_versions(self):
        from google.cloud.bigtable.column_family import MaxVersionsGCRule

        orig_rule = MaxVersionsGCRule(1)
        gc_rule_pb = orig_rule.to_pb()
        result = self._call_fut(gc_rule_pb)
        self.assertIsInstance(result, MaxVersionsGCRule)
        self.assertEqual(result, orig_rule)
    def test_max_num_versions(self):
        from google.cloud.bigtable.column_family import MaxVersionsGCRule

        orig_rule = MaxVersionsGCRule(1)
        gc_rule_pb = orig_rule.to_pb()
        result = self._callFUT(gc_rule_pb)
        self.assertTrue(isinstance(result, MaxVersionsGCRule))
        self.assertEqual(result, orig_rule)
    def test_to_pb_with_rule(self):
        from google.cloud.bigtable.column_family import MaxVersionsGCRule

        gc_rule = MaxVersionsGCRule(1)
        column_family = self._make_one("column_family_id", None, gc_rule=gc_rule)
        pb_val = column_family.to_pb()
        expected = _ColumnFamilyPB(gc_rule=gc_rule.to_pb())
        self.assertEqual(pb_val, expected)
def test__gc_rule_from_pb_max_num_versions():
    from google.cloud.bigtable.column_family import _gc_rule_from_pb
    from google.cloud.bigtable.column_family import MaxVersionsGCRule

    orig_rule = MaxVersionsGCRule(1)
    gc_rule_pb = orig_rule.to_pb()
    result = _gc_rule_from_pb(gc_rule_pb)
    assert isinstance(result, MaxVersionsGCRule)
    assert result == orig_rule
def test_column_family_to_pb_with_rule():
    from google.cloud.bigtable.column_family import MaxVersionsGCRule

    gc_rule = MaxVersionsGCRule(1)
    column_family = _make_column_family("column_family_id",
                                        None,
                                        gc_rule=gc_rule)
    pb_val = column_family.to_pb()
    expected = _ColumnFamilyPB(gc_rule=gc_rule.to_pb())
    assert pb_val == expected