Example #1
0
    def test_validate_filled_column_config(self):
        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_filled_column_config(
                {"name": "a"})

        # Shouldn't throw
        BulkAnnotationConfiguration.validate_column_config(expected(name="a"))
    def test_validate_filled_column_config(self):
        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_filled_column_config({
                "name": "a"})

        # Shouldn't throw
        BulkAnnotationConfiguration.validate_column_config(expected(name="a"))
Example #3
0
 def test_init_def(self):
     c = BulkAnnotationConfiguration({
         "visible": False,
         "omitempty": True
     }, [])
     assert c.default_cfg == expected(visible=False, omitempty=True)
     assert c.column_cfgs == []
Example #4
0
 def test_init_def_col(self):
     c = BulkAnnotationConfiguration({"omitempty": True}, [
         {"name": "a1"}, {"name": "b2", "omitempty": False}])
     assert c.default_cfg == expected(omitempty=True)
     assert len(c.column_cfgs) == 2
     assert c.column_cfgs[0] == expected(name="a1", omitempty=True)
     assert c.column_cfgs[1] == expected(name="b2")
Example #5
0
 def test_init_col(self):
     c = BulkAnnotationConfiguration(None, [
         {"name": "a1", "visible": False, "position": 2},
         {"name": "b2", "position": 4}])
     assert c.default_cfg == expected()
     assert len(c.column_cfgs) == 2
     assert c.column_cfgs[0] == expected(
         name="a1", visible=False, position=2)
     assert c.column_cfgs[1] == expected(
         name="b2", position=4)
Example #6
0
 def test_init_group(self):
     c = BulkAnnotationConfiguration({"omitempty": True}, [
         {"name": "a1"},
         {"group": {"namespace": "group2", "columns": [{"name": "b2"}]}}
     ])
     assert c.default_cfg == expected(omitempty=True)
     assert len(c.column_cfgs) == 1
     assert c.column_cfgs[0] == expected(name="a1", omitempty=True)
     assert len(c.group_cfgs) == 1
     assert c.group_cfgs[0] == GroupConfig(
         "group2", [expected(name="b2", omitempty=True)])
Example #7
0
    def test_validate_group_config(self):
        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_group_config({
                "namespace": "ga"})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_group_config({
                "columns": [{"name": "a"}]})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_group_config({
                "namespace": "", "columns": [{"name": "a"}]})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_group_config({
                "namespace": "ga", "columns": [{"name": "a"}],
                "nonexistent": "na"})

        # Shouldn't throw
        BulkAnnotationConfiguration.validate_group_config({
            "namespace": "ga", "columns": [{"name": "a"}]})
Example #8
0
 def test_init_none(self):
     c = BulkAnnotationConfiguration(None, [])
     assert c.default_cfg == expected()
     assert c.column_cfgs == []
Example #9
0
    def test_validate_column_config(self):
        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_column_config({})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_column_config({"name": ""})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_column_config(
                {"non-existent": 1})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_column_config({})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_column_config(
                {"include": False})

        # Shouldn't throw
        BulkAnnotationConfiguration.validate_column_config({"name": "a"})
        BulkAnnotationConfiguration.validate_column_config({
            "name": "a",
            "includeclient": False,
            "include": False
        })
    def test_validate_column_config(self):
        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_column_config({})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_column_config({"name": ""})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_column_config({
                "non-existent": 1})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_column_config({})

        with pytest.raises(Exception):
            BulkAnnotationConfiguration.validate_column_config({
                "include": False})

        # Shouldn't throw
        BulkAnnotationConfiguration.validate_column_config({"name": "a"})
        BulkAnnotationConfiguration.validate_column_config({
            "name": "a", "includeclient": False, "include": False})