|
19 | 19 | from patsy.build import * |
20 | 20 | from patsy.categorical import C |
21 | 21 | from patsy.user_util import balanced, LookupFactor |
22 | | -from patsy.design_info import DesignMatrix |
| 22 | +from patsy.design_info import DesignMatrix, DesignInfo |
23 | 23 |
|
24 | 24 | if have_pandas: |
25 | 25 | import pandas |
@@ -667,7 +667,7 @@ def test_contrast(): |
667 | 667 | [7, 12], |
668 | 668 | [2, 13]]) |
669 | 669 |
|
670 | | -def test_DesignMatrixBuilder_subset(): |
| 670 | +def test_DesignInfo_subset(): |
671 | 671 | # For each combination of: |
672 | 672 | # formula, term names, term objects, mixed term name and term objects |
673 | 673 | # check that results match subset of full build |
@@ -730,3 +730,9 @@ def t(which_terms, variables, columns): |
730 | 730 | assert_raises(KeyError, all_builder.subset, ["asdf"]) |
731 | 731 | assert_raises(KeyError, |
732 | 732 | all_builder.subset, [Term(["asdf"])]) |
| 733 | + |
| 734 | + # Also check for a minimal DesignInfo (column names only) |
| 735 | + min_di = DesignInfo(["a", "b", "c"]) |
| 736 | + min_di_subset = min_di.subset(["c", "a"]) |
| 737 | + assert min_di_subset.column_names == ["c", "a"] |
| 738 | + assert min_di_subset.terms is None |
0 commit comments