|
6 | 6 | import numpy as np |
7 | 7 | import pytest |
8 | 8 | from pygmt.exceptions import GMTInvalidInput |
9 | | -from pygmt.helpers import GMTTempFile, data_kind, kwargs_to_strings, unique_name |
| 9 | +from pygmt.helpers import ( |
| 10 | + GMTTempFile, |
| 11 | + args_in_kwargs, |
| 12 | + data_kind, |
| 13 | + kwargs_to_strings, |
| 14 | + unique_name, |
| 15 | +) |
10 | 16 |
|
11 | 17 |
|
12 | 18 | @pytest.mark.parametrize( |
@@ -90,3 +96,17 @@ def test_gmttempfile_read(): |
90 | 96 | ftmp.write("in.dat: N = 2\t<1/3>\t<2/4>\n") |
91 | 97 | assert tmpfile.read() == "in.dat: N = 2 <1/3> <2/4>\n" |
92 | 98 | assert tmpfile.read(keep_tabs=True) == "in.dat: N = 2\t<1/3>\t<2/4>\n" |
| 99 | + |
| 100 | + |
| 101 | +def test_args_in_kwargs(): |
| 102 | + "Test that args_in_kwargs function returns correct Boolean responses." |
| 103 | + kwargs = {"A": 1, "B": 2, "C": 3} |
| 104 | + # Passing list of arguments with passing values in the beginning |
| 105 | + passing_args_1 = ["B", "C", "D"] |
| 106 | + assert args_in_kwargs(args=passing_args_1, kwargs=kwargs) |
| 107 | + # Passing list of arguments that starts with failing arguments |
| 108 | + passing_args_2 = ["D", "X", "C"] |
| 109 | + assert args_in_kwargs(args=passing_args_2, kwargs=kwargs) |
| 110 | + # Failing list of arguments |
| 111 | + failing_args = ["D", "E", "F"] |
| 112 | + assert not args_in_kwargs(args=failing_args, kwargs=kwargs) |
0 commit comments