def testRequiredFields(self): required = SampleAttribute.required_fields() self.assertEqual(type(required), tuple, "required_fields() returns a tuple.") self.assertTrue(len(required) > 0, "required_field() did not return empty value.")
def testRequiredFields(self): """ Test the required_fields() static method. """ required = SampleAttribute.required_fields() self.assertEqual(type(required), tuple, "required_fields() returns a tuple.") self.assertTrue( len(required) > 0, "required_field() did not return empty value.")
import json import logging from cutlass import SampleAttribute from cutlass import iHMPSession from pprint import pprint import tempfile import sys username = "******" password = "******" session = iHMPSession(username, password) print("Required fields: ") print(SampleAttribute.required_fields()) attrib = SampleAttribute() attrib.fecalcal = "test fecalcal" attrib.study = "prediabetes" # SampleAttributes are 'associated_with' samples attrib.links = { "associated_with": [ "610a4911a5ca67de12cdc1e4b4011876" ] } attrib.tags = [ "sample_attr", "ihmp" ] attrib.add_tag("sample") print(attrib.to_json(indent=2)) if attrib.is_valid():
root = logging.getLogger() root.setLevel(logging.DEBUG) ch = logging.StreamHandler(sys.stdout) ch.setLevel(logging.DEBUG) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFormatter(formatter) root.addHandler(ch) set_logging() session = iHMPSession(username, password) print("Required fields: ") print(SampleAttribute.required_fields()) attrib = SampleAttribute() attrib.fecalcal = "test fecalcal" attrib.study = "prediabetes" # SampleAttributes are 'associated_with' samples attrib.links = {"associated_with": ["610a4911a5ca67de12cdc1e4b4011876"]} attrib.tags = ["sample_attr", "ihmp"] attrib.add_tag("sample") attrib.sample_desc = "DNA: mom-vaginal" attrib.sample_type = "BC1D" attrib.subproject = "earlyPregStudy"