this repo has no description
at trunk 28 lines 839 B view raw
1#!/usr/bin/env python3 2# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) 3import unittest 4from operator import attrgetter, itemgetter 5 6 7class AttrGetterTests(unittest.TestCase): 8 def test_dunder_repr_with_string_attr(self): 9 self.assertEqual(repr(attrgetter("x")), "operator.attrgetter('x')") 10 11 12class ItemGetterTests(unittest.TestCase): 13 def test_dunder_repr_with_simple_items(self): 14 self.assertEqual( 15 repr(itemgetter("x", 1, [])), "operator.itemgetter('x', 1, [])" 16 ) 17 18 def test_dunder_repr_with_recursion(self): 19 container = [] 20 getter = itemgetter(container) 21 container.append(getter) 22 self.assertEqual( 23 repr(getter), "operator.itemgetter([operator.itemgetter(...)])" 24 ) 25 26 27if __name__ == "__main__": 28 unittest.main()