aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/deprecated/python/ruamel.ordereddict/tests/test_py27.py
blob: 3772adaa97c7afb27076f736c98dbaba3700d5fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

import sys
import pytest

from ruamel.ordereddict import ordereddict, sorteddict

assert sys.version_info[:2] == (2, 7)

class TestOrderedDictView:
    def test_key(self):
        d = ordereddict()
        d['a'] = 1
        d['b'] = 2
        print(d.viewkeys())
        assert "dict_keys(['a', 'b'])" == str(d.viewkeys())

    def test_values(self):
        d = ordereddict()
        d['a'] = 1
        d['b'] = 2
        print(d.viewvalues())
        assert "dict_values([1, 2])" == str(d.viewvalues())

    def test_items(self):
        d = ordereddict()
        d['a'] = 1
        d['b'] = 2
        print(d.viewitems())
        assert "dict_items([('a', 1), ('b', 2)])" == str(d.viewitems())