Dataset Viewer
Auto-converted to Parquet
instance_id
string
patch
string
repo
string
base_commit
string
hints_text
string
test_patch
string
problem_statement
string
version
string
FAIL_TO_PASS
sequence
PASS_TO_PASS
sequence
created_at
string
12rambau__sepal_ui-644
diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 9fc498b3..fc69f702 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -72,17 +72,19 @@ jobs: assert len(unexpected) == 0 - name: test with pytest - run: coverage run -m pytest --color=yes --instafail tests + run: pytest --color=yes --cov --cov-report=xml --instafail tests + + - name: assess dead fixtures + if: matrix.python-version == '3.8' + run: pytest --dead-fixtures - name: build the template panel application if: matrix.python-version == '3.8' - run: | - pytest --nbmake sepal_ui/templates/panel_app/ui.ipynb + run: pytest --nbmake sepal_ui/templates/panel_app/ui.ipynb - name: build the template map application if: matrix.python-version == '3.8' - run: | - pytest --nbmake sepal_ui/templates/map_app/ui.ipynb + run: pytest --nbmake sepal_ui/templates/map_app/ui.ipynb - name: coverage run: coverage xml diff --git a/sepal_ui/sepalwidgets/btn.py b/sepal_ui/sepalwidgets/btn.py index 137622fa..105f6160 100644 --- a/sepal_ui/sepalwidgets/btn.py +++ b/sepal_ui/sepalwidgets/btn.py @@ -25,6 +25,9 @@ class Btn(v.Btn, SepalWidget): .. deprecated:: 2.13 ``text`` and ``icon`` will be replaced by ``msg`` and ``gliph`` to avoid duplicating ipyvuetify trait. + + .. deprecated:: 2.14 + Btn is not using a default ``msg`` anymor`. """ v_icon = None @@ -36,7 +39,7 @@ class Btn(v.Btn, SepalWidget): msg = Unicode("").tag(sync=True) "traitlet.Unicode: the text of the btn" - def __init__(self, msg="Click", gliph="", **kwargs): + def __init__(self, msg="", gliph="", **kwargs): # deprecation in 2.13 of text and icon # as they already exist in the ipyvuetify Btn traits (as booleans) @@ -55,7 +58,7 @@ class Btn(v.Btn, SepalWidget): ) # create the default v_icon - self.v_icon = v.Icon(left=True, children=[""]) + self.v_icon = v.Icon(children=[""]) # set the default parameters kwargs["color"] = kwargs.pop("color", "primary") @@ -89,6 +92,7 @@ class Btn(v.Btn, SepalWidget): Set the text of the btn """ + self.v_icon.left = bool(change["new"]) self.children = [self.v_icon, change["new"]] return self diff --git a/setup.py b/setup.py index 84775ae4..e7ca3ccf 100644 --- a/setup.py +++ b/setup.py @@ -65,7 +65,7 @@ setup_params = { "cryptography", "python-box", "xyzservices", - "planet==2.0a2", # this is a prerelease + "planet>=2.0", "pyyaml", "dask", "tqdm", @@ -83,6 +83,8 @@ setup_params = { "pytest-sugar", "pytest-icdiff", "pytest-instafail", + "pytest-deadfixtures", + "pytest-cov", "nbmake ", ], "doc": [
12rambau/sepal_ui
8a8196e3c7893b7a0aebdb4910e83054f59e0374
diff --git a/tests/test_Btn.py b/tests/test_Btn.py index fcaed760..4e3cb9b5 100644 --- a/tests/test_Btn.py +++ b/tests/test_Btn.py @@ -11,7 +11,7 @@ class TestBtn: btn = sw.Btn() assert btn.color == "primary" assert btn.v_icon.children[0] == "" - assert btn.children[1] == "Click" + assert btn.children[1] == "" # extensive btn btn = sw.Btn("toto", "fas fa-folder") @@ -42,12 +42,18 @@ class TestBtn: assert isinstance(btn.v_icon, v.Icon) assert btn.v_icon.children[0] == gliph + assert btn.v_icon.left is True # change existing icon gliph = "fas fa-file" btn.gliph = gliph assert btn.v_icon.children[0] == gliph + # display only the gliph + btn.msg = "" + assert btn.children[1] == "" + assert btn.v_icon.left is False + # remove all gliph gliph = "" btn.gliph = gliph @@ -79,4 +85,4 @@ class TestBtn: def btn(self): """Create a simple btn""" - return sw.Btn() + return sw.Btn("Click") diff --git a/tests/test_PlanetModel.py b/tests/test_PlanetModel.py index f84d2e1f..d6d63c5a 100644 --- a/tests/test_PlanetModel.py +++ b/tests/test_PlanetModel.py @@ -9,11 +9,17 @@ from sepal_ui.planetapi import PlanetModel @pytest.mark.skipif("PLANET_API_KEY" not in os.environ, reason="requires Planet") class TestPlanetModel: - @pytest.mark.parametrize("credentials", ["planet_key", "cred"]) - def test_init(self, credentials, request): + def test_init(self, planet_key, cred, request): + + # Test with a valid api key + planet_model = PlanetModel(planet_key) + + assert isinstance(planet_model, PlanetModel) + assert isinstance(planet_model.session, planet.http.Session) + assert planet_model.active is True - # Test with a valid api key and login credentials - planet_model = PlanetModel(request.getfixturevalue(credentials)) + # Test with a valid login credentials + planet_model = PlanetModel(cred) assert isinstance(planet_model, PlanetModel) assert isinstance(planet_model.session, planet.http.Session) @@ -56,10 +62,7 @@ class TestPlanetModel: return - def test_is_active(self, planet_key): - - # We only need to test with a key. - planet_model = PlanetModel(planet_key) + def test_is_active(self, planet_model): planet_model._is_active() assert planet_model.active is True @@ -69,9 +72,8 @@ class TestPlanetModel: return - def test_get_subscriptions(self, planet_key): + def test_get_subscriptions(self, planet_model): - planet_model = PlanetModel(planet_key) subs = planet_model.get_subscriptions() # Check object has length, because there is no way to check a value @@ -80,10 +82,7 @@ class TestPlanetModel: return - def test_get_planet_items(self, planet_key): - - # Arrange - planet_model = PlanetModel(planet_key) + def test_get_planet_items(self, planet_model): aoi = { # Yasuni national park in Ecuador "type": "Polygon", @@ -119,3 +118,11 @@ class TestPlanetModel: credentials = json.loads(os.getenv("PLANET_API_CREDENTIALS")) return list(credentials.values()) + + @pytest.fixture + def planet_model(self): + """Start a planet model using the API key""" + + key = os.getenv("PLANET_API_KEY") + + return PlanetModel(key)
sepal_ui.Btn does't work as expected I want to create a simple Icon button, to do so: ```python sw.Btn(icon=True, gliph ="mdi-plus") ``` Doing this, without "msg" parameter will add the default text to the button which is "click", I think is worthless having that value. So if I want to remove the default text, I would expect doing this: ```python sw.Btn(children = [""], icon=True, gliph ="mdi-plus") # or sw.Btn(msg= ""] icon=True, gliph ="mdi-plus") ``` Which leads the icon aligned to the left and not centered (as it is using a empyt string as message).
0.0
[ "tests/test_Btn.py::TestBtn::test_init", "tests/test_Btn.py::TestBtn::test_set_gliph" ]
[ "tests/test_Btn.py::TestBtn::test_toggle_loading", "tests/test_Btn.py::TestBtn::test_set_msg" ]
2022-11-29 14:42:21+00:00

No dataset card yet

Downloads last month
25