def test_create_study_dict():

    expected = {"StudyID": None, "StudyDescription": None, "StudyLocDecDeg": None}
    
    actual = waterxml.create_study_dict()

    nose.tools.assert_equals(actual["StudyID"], expected["StudyID"])
    nose.tools.assert_equals(actual["StudyDescription"], expected["StudyDescription"])
    nose.tools.assert_equals(actual["StudyLocDecDeg"], expected["StudyLocDecDeg"])
示例#2
0
def test_create_study_dict():

    expected = {
        "StudyID": None,
        "StudyDescription": None,
        "StudyLocDecDeg": None
    }

    actual = waterxml.create_study_dict()

    nose.tools.assert_equals(actual["StudyID"], expected["StudyID"])
    nose.tools.assert_equals(actual["StudyDescription"],
                             expected["StudyDescription"])
    nose.tools.assert_equals(actual["StudyLocDecDeg"],
                             expected["StudyLocDecDeg"])
def test_fill_dict():
    
    expected_project = {"ProjID": "1", "UserName": "******", "DateCreated": "2014-04-22T10:00:00.0000-00:00", "ProjName": "my-project"}
    expected_study = {"StudyID": "1", "StudyDescription": "Test simulation", "StudyLocDecDeg": "40.5, -75.9"}
       
    project = waterxml.create_project_dict() 
    study = waterxml.create_study_dict()
    
    actual_project = waterxml.fill_dict(waterxml_tree = fixture["xml_tree1"], data_dict = project, element = "Project", keys = project.keys())
    actual_study = waterxml.fill_dict(waterxml_tree = fixture["xml_tree1"], data_dict = study, element = "Study", keys = study.keys())

    nose.tools.assert_equals(actual_project["ProjID"], expected_project["ProjID"])
    nose.tools.assert_equals(actual_project["UserName"], expected_project["UserName"])
    nose.tools.assert_equals(actual_project["DateCreated"], expected_project["DateCreated"])
    nose.tools.assert_equals(actual_project["ProjName"], expected_project["ProjName"])
    
    nose.tools.assert_equals(actual_study["StudyID"], expected_study["StudyID"])
    nose.tools.assert_equals(actual_study["StudyDescription"], expected_study["StudyDescription"])
    nose.tools.assert_equals(actual_study["StudyLocDecDeg"], expected_study["StudyLocDecDeg"])
示例#4
0
def test_fill_dict():

    expected_project = {
        "ProjID": "1",
        "UserName": "******",
        "DateCreated": "2014-04-22T10:00:00.0000-00:00",
        "ProjName": "my-project"
    }
    expected_study = {
        "StudyID": "1",
        "StudyDescription": "Test simulation",
        "StudyLocDecDeg": "40.5, -75.9"
    }

    project = waterxml.create_project_dict()
    study = waterxml.create_study_dict()

    actual_project = waterxml.fill_dict(waterxml_tree=fixture["xml_tree1"],
                                        data_dict=project,
                                        element="Project",
                                        keys=project.keys())
    actual_study = waterxml.fill_dict(waterxml_tree=fixture["xml_tree1"],
                                      data_dict=study,
                                      element="Study",
                                      keys=study.keys())

    nose.tools.assert_equals(actual_project["ProjID"],
                             expected_project["ProjID"])
    nose.tools.assert_equals(actual_project["UserName"],
                             expected_project["UserName"])
    nose.tools.assert_equals(actual_project["DateCreated"],
                             expected_project["DateCreated"])
    nose.tools.assert_equals(actual_project["ProjName"],
                             expected_project["ProjName"])

    nose.tools.assert_equals(actual_study["StudyID"],
                             expected_study["StudyID"])
    nose.tools.assert_equals(actual_study["StudyDescription"],
                             expected_study["StudyDescription"])
    nose.tools.assert_equals(actual_study["StudyLocDecDeg"],
                             expected_study["StudyLocDecDeg"])