blob: f82453deefa9b03dbf09006d505228f70b5b2bf0 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file or at
4# https://developers.google.com/open-source/licenses/bsd
5
6"""Tests for ast_pb2 functions."""
7
8from __future__ import print_function
9from __future__ import division
10from __future__ import absolute_import
11
12import unittest
13
14from proto import ast_pb2
15from proto import tracker_pb2
16
17
18class ASTPb2Test(unittest.TestCase):
19
20 def testCond(self):
21 fd = tracker_pb2.FieldDef(field_id=1, field_name='Size')
22 cond = ast_pb2.MakeCond(
23 ast_pb2.QueryOp.EQ, [fd], ['XL'], [], key_suffix='-approver')
24 self.assertEqual(ast_pb2.QueryOp.EQ, cond.op)
25 self.assertEqual([fd], cond.field_defs)
26 self.assertEqual(['XL'], cond.str_values)
27 self.assertEqual([], cond.int_values)
28 self.assertEqual(cond.key_suffix, '-approver')