0
0
mirror of https://github.com/python/cpython.git synced 2024-11-28 16:45:42 +01:00
cpython/Lib/test/test_dictviews.py

29 lines
739 B
Python
Raw Normal View History

2007-02-10 02:11:45 +01:00
import unittest
from test import test_support
class DictSetTest(unittest.TestCase):
def test_dict_keys(self):
d = {1: 10, "a": "ABC"}
keys = d.KEYS()
self.assertEqual(set(keys), {1, "a"})
self.assertEqual(len(keys), 2)
2007-02-10 02:11:45 +01:00
def test_dict_items(self):
d = {1: 10, "a": "ABC"}
items = d.ITEMS()
self.assertEqual(set(items), {(1, 10), ("a", "ABC")})
self.assertEqual(len(items), 2)
2007-02-10 02:11:45 +01:00
def test_dict_values(self):
d = {1: 10, "a": "ABC"}
values = d.VALUES()
self.assertEqual(set(values), {10, "ABC"})
self.assertEqual(len(values), 2)
2007-02-10 02:11:45 +01:00
def test_main():
test_support.run_unittest(DictSetTest)
if __name__ == "__main__":
test_main()