def test_does_not_sort_values_when_using_ordered_dict():
    enum = GraphQLEnumType(name='Test', values=OrderedDict([
        ('c', GraphQLEnumValue()),
        ('b', GraphQLEnumValue()),
        ('a', GraphQLEnumValue()),
        ('d', GraphQLEnumValue()),
    ]))

    assert [v.name for v in enum.get_values()] == ['c', 'b', 'a', 'd']
def test_sorts_values_if_not_using_ordered_dict():
    enum = GraphQLEnumType(name='Test', values={
        'c': GraphQLEnumValue(),
        'b': GraphQLEnumValue(),
        'a': GraphQLEnumValue(),
        'd': GraphQLEnumValue()
    })

    assert [v.name for v in enum.get_values()] == ['a', 'b', 'c', 'd']
Example #3
0
def test_does_not_sort_values_when_using_ordered_dict():
    enum = GraphQLEnumType(name='Test',
                           values=OrderedDict([
                               ('c', GraphQLEnumValue()),
                               ('b', GraphQLEnumValue()),
                               ('a', GraphQLEnumValue()),
                               ('d', GraphQLEnumValue()),
                           ]))

    assert [v.name for v in enum.get_values()] == ['c', 'b', 'a', 'd']
Example #4
0
def test_sorts_values_if_not_using_ordered_dict():
    enum = GraphQLEnumType(name='Test',
                           values={
                               'c': GraphQLEnumValue(),
                               'b': GraphQLEnumValue(),
                               'a': GraphQLEnumValue(),
                               'd': GraphQLEnumValue()
                           })

    assert [v.name for v in enum.get_values()] == ['a', 'b', 'c', 'd']