示例#1
0
 def test_can_chain_select(self):
     view = PropertyDictView({"A": 1, "B": 2, "C": 3}).B.C
     self.assertEqual(repr(view), "{B: 2, C: 3}")
示例#2
0
 def test_can_create_double_property_view(self):
     view = PropertyDictView({"A": 1, "B": 2})
     self.assertEqual(repr(view), "{A: 1, B: 2}")
示例#3
0
 def test_can_select_non_existing_in_view(self):
     view = PropertyDictView({"A": 1, "B": 2}).C
     self.assertEqual(repr(view), "{}")
示例#4
0
 def test_can_create_single_property_view(self):
     view = PropertyDictView({"A": 1})
     self.assertEqual(repr(view), "{A: 1}")
示例#5
0
 def test_can_create_empty_view(self):
     view = PropertyDictView({})
     self.assertEqual(repr(view), "{}")
示例#6
0
 def test_non_containment(self):
     view = PropertyDictView({"A": 1, "B": 2, "C": 3})
     self.assertNotIn("D", view)
示例#7
0
 def test_iterable(self):
     view = PropertyDictView({"A": 1, "B": 2, "C": 3})
     self.assertEqual(set(view), {"A", "B", "C"})
示例#8
0
 def test_length(self):
     view = PropertyDictView({"A": 1, "B": 2, "C": 3})
     self.assertEqual(len(view), 3)