Пример #1
0
 def test_create_project_expression_with_document_paths(self):
     attributes_to_get = [Path('foo.bar')[0]]
     placeholders = {}
     projection_expression = create_projection_expression(
         attributes_to_get, placeholders)
     assert projection_expression == "#0.#1[0]"
     assert placeholders == {'foo': '#0', 'bar': '#1'}
Пример #2
0
 def test_create_project_expression_with_attribute_names(self):
     attributes_to_get = [Path('foo.bar', attribute_name=True)[0]]
     placeholders = {}
     projection_expression = create_projection_expression(
         attributes_to_get, placeholders)
     assert projection_expression == "#0[0]"
     assert placeholders == {'foo.bar': '#0'}
Пример #3
0
 def test_document_path(self):
     path = Path('foo.bar')
     assert str(path) == 'foo.bar'
     assert repr(path) == "Path('foo.bar', attribute_name=False)"
Пример #4
0
 def test_index_invalid(self):
     with self.assertRaises(TypeError):
         Path('foo.bar')['foo']
Пример #5
0
 def test_index_attribute_name(self):
     path = Path('foo.bar', attribute_name=True)[0]
     assert str(path) == "'foo.bar'[0]"
     assert repr(path) == "Path('foo.bar[0]', attribute_name=True)"
Пример #6
0
 def test_index_document_path(self):
     path = Path('foo.bar')[0]
     assert str(path) == 'foo.bar[0]'
     assert repr(path) == "Path('foo.bar[0]', attribute_name=False)"
Пример #7
0
 def test_attribute_name(self):
     path = Path('foo.bar', attribute_name=True)
     assert str(path) == "'foo.bar'"
     assert repr(path) == "Path('foo.bar', attribute_name=True)"