def test_create_frame(self): db = Index("foo") frame = db.frame("sample-frame") self.assertEqual(db, frame.index) self.assertEqual("sample-frame", frame.name) self.assertEqual("rowID", frame.row_label) self.assertEqual(TimeQuantum.NONE, frame.time_quantum)
def get_schema(): repository = Index("repository", column_label="repo_id") stargazer = repository.frame("stargazer", row_label="stargazer_id", time_quantum=TimeQuantum.YEAR_MONTH_DAY, inverse_enabled=True) language = repository.frame("language", row_label="language_id", inverse_enabled=True) return repository, stargazer, language
def test_get_options_string(self): index = Index("my-index") self.assertEqual('', index._get_options_string()) index = Index("my-index", keys=True) self.assertEqual('{"options": {"keys": true}}', index._get_options_string()) index = Index("my-index", track_existence=True) self.assertEqual('{"options": {"trackExistence": true}}', index._get_options_string())
def test_create_field(self): db = Index("foo") field = db.field("sample-field") self.assertEqual(db, field.index) self.assertEqual("sample-field", field.name) self.assertEqual(TimeQuantum.NONE, field.time_quantum)
def test_get_options_string(self): index = Index("my-index", keys=True) self.assertEqual('{"options":{"keys":true}}', index._get_options_string())