MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / UnicodeIdentifiersTests

Class UnicodeIdentifiersTests

tests/unit/test_metadata.py:637–708  ·  view source on GitHub ↗

Exercise cql generation with unicode characters. Keyspace, Table, and Index names cannot have special chars because C* names files by those identifiers, but they are tested anyway. Looking for encoding errors like PYTHON-447

Source from the content-addressed store, hash-verified

635
636
637class UnicodeIdentifiersTests(unittest.TestCase):
638 """
639 Exercise cql generation with unicode characters. Keyspace, Table, and Index names
640 cannot have special chars because C* names files by those identifiers, but they are
641 tested anyway.
642
643 Looking for encoding errors like PYTHON-447
644 """
645
646 name = b'\'_-()"\xc2\xac'.decode('utf-8')
647
648 def test_keyspace_name(self):
649 km = KeyspaceMetadata(self.name, False, 'SimpleStrategy', {'replication_factor': 1})
650 km.export_as_string()
651
652 def test_table_name(self):
653 tm = TableMetadata(self.name, self.name)
654 tm.export_as_string()
655
656 def test_column_name_single_partition(self):
657 tm = TableMetadata('ks', 'table')
658 cm = ColumnMetadata(tm, self.name, u'int')
659 tm.columns[cm.name] = cm
660 tm.partition_key.append(cm)
661 tm.export_as_string()
662
663 def test_column_name_single_partition_single_clustering(self):
664 tm = TableMetadata('ks', 'table')
665 cm = ColumnMetadata(tm, self.name, u'int')
666 tm.columns[cm.name] = cm
667 tm.partition_key.append(cm)
668 cm = ColumnMetadata(tm, self.name + 'x', u'int')
669 tm.columns[cm.name] = cm
670 tm.clustering_key.append(cm)
671 tm.export_as_string()
672
673 def test_column_name_multiple_partition(self):
674 tm = TableMetadata('ks', 'table')
675 cm = ColumnMetadata(tm, self.name, u'int')
676 tm.columns[cm.name] = cm
677 tm.partition_key.append(cm)
678 cm = ColumnMetadata(tm, self.name + 'x', u'int')
679 tm.columns[cm.name] = cm
680 tm.partition_key.append(cm)
681 tm.export_as_string()
682
683 def test_index(self):
684 im = IndexMetadata(self.name, self.name, self.name, kind='', index_options={'target': self.name})
685 log.debug(im.export_as_string())
686 im = IndexMetadata(self.name, self.name, self.name, kind='CUSTOM', index_options={'target': self.name, 'class_name': 'Class'})
687 log.debug(im.export_as_string())
688 # PYTHON-1008
689 im = IndexMetadata(self.name, self.name, self.name, kind='CUSTOM', index_options={'target': self.name, 'class_name': 'Class', 'delimiter': self.name})
690 log.debug(im.export_as_string())
691
692 def test_function(self):
693 fm = Function(keyspace=self.name, name=self.name,
694 argument_types=(u'int', u'int'),

Callers

nothing calls this directly

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected