示例#1
0
 def test_converts_2_arg_selector_into_a_dict(self):
     assert Container()._extract_selector('how', 'what') == {'how': 'what'}
示例#2
0
 def test_returns_the_kwargs_given(self):
     assert Container()._extract_selector(how='what') == {'how': 'what'}
示例#3
0
 def test_raises_correct_exception_if_given_1_arg(self):
     with pytest.raises(ValueError):
         Container()._extract_selector('how')
示例#4
0
 def test_raises_correct_exception_if_given_over_2_args(self):
     with pytest.raises(ValueError):
         Container()._extract_selector('how', 'what', 'value')
示例#5
0
 def test_returns_an_empty_dict_if_given_no_args(self):
     assert Container()._extract_selector() == {}
示例#6
0
 def test_allows_multiple_regex_to_be_passed_by_string(self):
     assert Container._extract_selector(how=r'/what/',
                                        foo=r'/bar\dspam/') == {
                                            'how': compile(r'what'),
                                            'foo': compile(r'bar\dspam')
                                        }
示例#7
0
 def test_allows_regex_to_be_passed_by_string(self):
     assert Container._extract_selector(how=r'/what/') == {
         'how': compile(r'what')
     }
示例#8
0
 def test_accepts_1_arg_if_dict_and_merges_with_kwargs(self):
     assert Container._extract_selector({'how': 'what'}, foo='bar') == {
         'how': 'what',
         'foo': 'bar'
     }
示例#9
0
 def test_accepts_1_arg_if_dict(self):
     assert Container._extract_selector({'how': 'what'}) == {'how': 'what'}