Exemple #1
0
 def test_tuple_unicode(self):
     """
     Tuples whose value is unicode are a key/value pair.
     """
     C = COLORS(colored)
     get_name = get_name_factory(C)
     self.assertThat(
         get_name((u'key\x1bname', u'hello')),
         ExactlyEquals(u'{}: hello'.format(C.prop(u'key\u241bname'))))
Exemple #2
0
 def test_tuple_dict(self):
     """
     Tuples whose value is a dict use the name in the first position of the
     tuple.
     """
     get_name = get_name_factory(None)
     self.assertThat(
         get_name((u'key\x1bname', {})),
         ExactlyEquals(u'key\u241bname'))
Exemple #3
0
 def test_tuple_root(self):
     """
     Tuples that are neither unicode nor a dict are assumed to be a root
     node.
     """
     C = COLORS(colored)
     get_name = get_name_factory(C)
     self.assertThat(
         get_name((u'key\x1bname', None)),
         ExactlyEquals(C.root(u'key\u241bname')))
Exemple #4
0
 def test_text(self):
     """
     Text leaves are their own name.
     """
     get_name = get_name_factory(None)
     self.assertThat(
         get_name(u'hello'),
         ExactlyEquals(u'hello'))
     self.assertThat(
         get_name(u'hello\x1b'),
         ExactlyEquals(u'hello\u241b'))
Exemple #5
0
 def test_node(self):
     """
     Task nodes use their own name.
     """
     tree = Tree()
     tree.merge_tasks([action_task])
     node = tree.nodes()[0][1]
     C = COLORS(colored)
     get_name = get_name_factory(C)
     self.assertThat(
         get_name(node),
         ExactlyEquals(node.name))
Exemple #6
0
 def test_node_failure(self):
     """
     Task nodes indicating failure are colored.
     """
     tree = Tree()
     tree.merge_tasks([action_task])
     node = tree.nodes()[0][1].copy()
     node.success = False
     C = COLORS(colored)
     get_name = get_name_factory(C)
     self.assertThat(
         get_name(node),
         ExactlyEquals(C.failure(node.name)))