Merge branch 'main' into avm99963-monorail
Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266
GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/mrproto/test/ast_pb2_test.py b/mrproto/test/ast_pb2_test.py
new file mode 100644
index 0000000..91bb8ec
--- /dev/null
+++ b/mrproto/test/ast_pb2_test.py
@@ -0,0 +1,27 @@
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Tests for ast_pb2 functions."""
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import absolute_import
+
+import unittest
+
+from mrproto import ast_pb2
+from mrproto import tracker_pb2
+
+
+class ASTPb2Test(unittest.TestCase):
+
+ def testCond(self):
+ fd = tracker_pb2.FieldDef(field_id=1, field_name='Size')
+ cond = ast_pb2.MakeCond(
+ ast_pb2.QueryOp.EQ, [fd], ['XL'], [], key_suffix='-approver')
+ self.assertEqual(ast_pb2.QueryOp.EQ, cond.op)
+ self.assertEqual([fd], cond.field_defs)
+ self.assertEqual(['XL'], cond.str_values)
+ self.assertEqual([], cond.int_values)
+ self.assertEqual(cond.key_suffix, '-approver')