Пример #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)