Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | # 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 | |
| 8 | from __future__ import print_function |
| 9 | from __future__ import division |
| 10 | from __future__ import absolute_import |
| 11 | |
| 12 | import unittest |
| 13 | |
| 14 | from proto import ast_pb2 |
| 15 | from proto import tracker_pb2 |
| 16 | |
| 17 | |
| 18 | class 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') |