Ejemplo n.º 1
0
 def loads_no_project_specific_file_if_no_project_location_given(self):
     c = Config()
     assert c._project_path is None
     c.load_project()
     assert list(c._project.keys()) == []
     defaults = ["tasks", "run", "runners", "sudo", "timeouts"]
     assert set(c.keys()) == set(defaults)
Ejemplo n.º 2
0
 def supports_readonly_dict_protocols(self):
     # Use single-keypair dict to avoid sorting problems in tests.
     c = Config(defaults={"foo": "bar"})
     c2 = Config(defaults={"foo": "bar"})
     assert "foo" in c
     assert "foo" in c2  # mostly just to trigger loading :x
     assert c == c2
     assert len(c) == 1
     assert c.get("foo") == "bar"
     if six.PY2:
         assert c.has_key("foo") is True  # noqa
         assert list(c.iterkeys()) == ["foo"]
         assert list(c.itervalues()) == ["bar"]
     assert list(c.items()) == [("foo", "bar")]
     assert list(six.iteritems(c)) == [("foo", "bar")]
     assert list(c.keys()) == ["foo"]
     assert list(c.values()) == ["bar"]
Ejemplo n.º 3
0
 def is_iterable_like_dict(self):
     c = Config(defaults={"a": 1, "b": 2})
     assert set(c.keys()) == {"a", "b"}
     assert set(list(c)) == {"a", "b"}