示例#1
0
文件: test_flag.py 项目: aurule/npc
def test_bool_truthy_when_present():
    tag = Flag('foreign')
    assert not tag
    tag.touch()
    assert tag
示例#2
0
文件: test_flag.py 项目: aurule/npc
def test_not_filled_with_no_values():
    flag = Flag('wanderer')
    flag.touch()
    assert not flag.filled
示例#3
0
文件: test_flag.py 项目: aurule/npc
def test_clear_resets_presence():
    tag = Flag('wanderer')
    tag.touch()
    assert tag.present
    tag.clear()
    assert not tag.present
示例#4
0
文件: test_flag.py 项目: aurule/npc
 def test_update_from_flag_copies_data(self):
     copyable = Flag('wanderer')
     copyable.append('lost')
     tag = Flag('wanderer')
     tag.update(copyable)
     assert tag.data == ['lost']
示例#5
0
文件: test_flag.py 项目: aurule/npc
def test_append_marks_presence_true():
    tag = Flag('wanderer')
    tag.append('')
    assert tag.present
示例#6
0
文件: test_flag.py 项目: aurule/npc
 def test_update_with_boolean_assigns_presence(self):
     tag = Flag('wanderer')
     tag.update(True)
     assert tag.present
示例#7
0
文件: test_flag.py 项目: aurule/npc
 def test_update_from_flag_copies_presence(self):
     copyable = Flag('wanderer')
     copyable.touch()
     tag = Flag('wanderer')
     tag.update(copyable)
     assert tag.present
示例#8
0
文件: test_flag.py 项目: aurule/npc
 def test_under_limit(self):
     tag = Flag('type', 'asdf', '1234', limit=5)
     tag.validate(strict=True)
     assert tag.valid
示例#9
0
文件: test_flag.py 项目: aurule/npc
 def test_negative_limit(self):
     tag = Flag('type', 'asdf', '1234', limit=-1)
     tag.validate(strict=True)
     assert tag.valid
示例#10
0
文件: test_flag.py 项目: aurule/npc
 def test_hidden_values_must_exist(self):
     tag = Flag('type', 'value1')
     tag.hide_value('value2')
     tag.validate()
     assert not tag.valid
     assert "Value 'value2' for tag 'type' cannot be hidden, because it does not exist" in tag.problems
示例#11
0
文件: test_flag.py 项目: aurule/npc
 def test_limit_exceeded(self):
     tag = Flag('type', 'asdf', '1234', limit=1)
     tag.validate(strict=True)
     assert not tag.valid
示例#12
0
文件: test_flag.py 项目: aurule/npc
 def test_limit_zero_and_required_are_fine(self):
     tag = Flag('type', 'asdf', required=True, limit=0)
     tag.validate()
     assert tag.valid
示例#13
0
文件: test_flag.py 项目: aurule/npc
def test_present_with_no_values():
    flag = Flag('wanderer')
    flag.touch()
    assert flag.present
示例#14
0
文件: test_flag.py 项目: aurule/npc
 def test_required_with_values_passes(self):
     tag = Flag('type', 'asdf', required=True)
     tag.validate()
     assert tag.valid
示例#15
0
文件: test_flag.py 项目: aurule/npc
def test_header_filled_with_no_values():
    flag = Flag('wanderer')
    flag.touch()
    header = flag.to_header()
    assert '@wanderer' in header
示例#16
0
 def test_add_flag_creates_flag_object(self):
     container = TagContainer()
     container.add_flag('wanderer', 'very yes')
     assert 'wanderer' in container
     assert container('wanderer') == Flag('wanderer', 'very yes')