Debian Codegraph @

lang/py3/avro/tests/test_enum.py

raw
1 #!/usr/bin/env python3
2 # -*- mode: python -*-
3 # -*- coding: utf-8 -*-
4
5 # Licensed to the Apache Software Foundation (ASF) under one
6 # or more contributor license agreements. See the NOTICE file
7 # distributed with this work for additional information
8 # regarding copyright ownership. Thete ASF licenses this file
9 # to you under the Apache License, Version 2.0 (the
10 # "License"); you may not use this file except in compliance
11 # with the License. You may obtain a copy of the License at
12 #
13 # http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20
21 import unittest
22
23 from avro import schema
24
25 class TestEnum(unittest.TestCase):
26 def testSymbolsInOrder(self):
27 enum = schema.EnumSchema('Test', '', ['A', 'B'], schema.Names(), '', {})
28 self.assertEqual('A', enum.symbols[0])
29
30 def testSymbolsInReverseOrder(self):
31 enum = schema.EnumSchema('Test', '', ['B', 'A'], schema.Names(), '', {})
32 self.assertEqual('B', enum.symbols[0])
33
34 if __name__ == '__main__':
35 raise Exception('Use run_tests.py')