示例#1
0
 def test_both_data(self):
     with pytest.raises(ValueError) as excinfo:
         Rule(self.reddit, self.subreddit, short_name="test", _data={})
     assert (excinfo.value.args[0] ==
             "Either short_name or _data needs to be given.")
示例#2
0
 def test_no_subreddit(self):
     rule = Rule(self.reddit, short_name="test")
     with pytest.raises(ValueError) as excinfo:
         getattr(rule, "subreddit")
     assert (excinfo.value.args[0] ==
             "The Rule is missing a subreddit. File a bug report at PRAW.")
示例#3
0
 def test_empty_value(self):
     with pytest.raises(ValueError):
         Rule(self.reddit, self.subreddit, short_name="")