Example #1
0
    def test_load_profile_error(self):
        with open(self.json_fname, "w") as fh:
            fh.write("foobar")
        with assert_raises(Exception):
            load_profile(self.json_fname)

        with open(self.yaml_fname, "w") as fh:
            fh.write("{foobar")
        with assert_raises(Exception):
            load_profile(self.yaml_fname)
Example #2
0
    def test_load_profile_error(self):
        with open(self.json_fname, "w") as fh:
            fh.write("foobar")
        with assert_raises(Exception):
            load_profile(self.json_fname)

        with open(self.yaml_fname, "w") as fh:
            fh.write("{foobar")
        with assert_raises(Exception):
            load_profile(self.yaml_fname)
Example #3
0
 def test_load_profile_json(self):
     with open(self.json_fname, "w") as fh:
         fh.write("""{"predictors":
             [{"name": "CommonNeighbours",
             "displayname": "Common neighbours"},
             {"name": "Cosine"}],
             "interpolation": true}""")
     profile = load_profile(self.json_fname)
     assert_dict_equal(profile, self.expected)
Example #4
0
    def test_load_profile_yaml(self):
        with open(self.yaml_fname, "w") as fh:
            fh.write("""predictors:
- name: CommonNeighbours
  displayname: Common neighbours
- name: Cosine
interpolation: true""")
        profile = load_profile(self.yaml_fname)
        assert_dict_equal(profile, self.expected)
Example #5
0
 def test_load_profile_json(self):
     with open(self.json_fname, "w") as fh:
         fh.write("""{"predictors":
             [{"name": "CommonNeighbours",
             "displayname": "Common neighbours"},
             {"name": "Cosine"}],
             "interpolation": true}""")
     profile = load_profile(self.json_fname)
     assert_dict_equal(profile, self.expected)
Example #6
0
    def test_load_profile_yaml(self):
        with open(self.yaml_fname, "w") as fh:
            fh.write("""predictors:
- name: CommonNeighbours
  displayname: Common neighbours
- name: Cosine
interpolation: true""")
        profile = load_profile(self.yaml_fname)
        assert_dict_equal(profile, self.expected)