Exemplo n.º 1
0
 def test_bg(self):
     input = [
         ("B", 1),
         ("u", 1),
         (1, 1),
         ("l", 1),
         ("g", 1),
         ("a", 1),
         ("r", 1),
         ("i", 1),
         (1, 2),
         (4, 3),
         ("a", 1),
         (3, 1),
     ]
     self.assertEqual("Bulgaria", solution.extract_type(input, str))
Exemplo n.º 2
0
 def test_num(self):
     input = [
         ("B", 1),
         ("u", 1),
         (1, 1),
         ("l", 1),
         ("g", 1),
         ("a", 1),
         ("r", 1),
         ("i", 1),
         (1, 2),
         (4, 3),
         ("a", 1),
         (3, 1),
     ]
     self.assertEqual("1114443", solution.extract_type(input, int))
Exemplo n.º 3
0
 def test_extract_type_with_bool(self):
     self.assertEqual(s.extract_type(self.data, bool),
                      'TrueTrueFalseFalse')
Exemplo n.º 4
0
 def test_extract_type_with_set(self):
     self.assertEqual(s.extract_type(self.data, set),
                      'set()set()set()set()set(){1, 2}{1, 2}{1, 2}')
Exemplo n.º 5
0
 def test_extract_type_with_tuple(self):
     self.assertEqual(s.extract_type(self.data, tuple),
                      '(1, 2)(1, 2)(3, 4)(3, 4)(3, 4)()()()')
Exemplo n.º 6
0
 def test_extract_type_with_bool(self):
     self.assertEqual(s.extract_type(self.data, bool), 'TrueTrueFalseFalse')
Exemplo n.º 7
0
 def test_with_empty_list(self):
     self.assertEqual('', s.extract_type([], type))
Exemplo n.º 8
0
 def test_num(self):
     input = [('B', 1), ('u', 1), (1, 1), ('l', 1), ('g', 1),
              ('a', 1), ('r', 1), ('i', 1), (1, 2), (4, 3),
              ('a', 1), (3, 1)]
     self.assertEqual("1114443", s.extract_type(input, int))
Exemplo n.º 9
0
 def test_python(self):
     input = [('p', 1), ('y', 1), ('t', 1),
              ('h', 1), ('o', 1), ('n', 1)]
     self.assertEqual("python", s.extract_type(input, str))
Exemplo n.º 10
0
 def test_some_types(self):
     input = [("a", 1), (5, 10), ("p", 2), ("l", 1), ("e", 1), (14, 2)]
     self.assertEqual("apple", solution.extract_type(input, str))
Exemplo n.º 11
0
 def test_python(self):
     input = [("p", 1), ("y", 1), ("t", 1), ("h", 1), ("o", 1), ("n", 1)]
     self.assertEqual("python", solution.extract_type(input, str))
Exemplo n.º 12
0
 def test_fave(self):
     input = [("r", 1), ("o", 1), (1, 1), ("s", 2), ("o", 1), (5, 0), ("n", 1), ("e", 1), (1, 2), ("r", 1), ("o", 1)]
     self.assertEqual("rossonero", solution.extract_type(input, str))
Exemplo n.º 13
0
 def test_snake(self):
     input = [('s', 1), ('n', 1), ('a', 1),
              ('k', 1), ('e', 1), (55, 1)]
     self.assertEqual("snake", solution.extract_type(input, str))
Exemplo n.º 14
0
 def test_number(self):
     input = [('hg', 19), ('h', 15), (1, 4), ('kk', 4), ('yu', 1),
              ('a', 1), ('k', 1), ('qqw', 1), (1, 2), (4, 3),
              ('kl', 1), (3, 10)]
     self.assertEqual("1111114443333333333", solution.extract_type(input, int))
Exemplo n.º 15
0
 def test_bool(self):
     input_ = [(True, 1), ("and", 1), (False, 1), ('==', 1), (False, 1)]
     self.assertEqual("TrueFalseFalse", s.extract_type(input_, bool))
Exemplo n.º 16
0
 def test_int(self):
     input_ = [({'a': 10}, 1), (1, 4), (0.2, 3), (2, 3), (True, 2),
               (3, 2), ("something", 1), (4, 1), (5, 0)]
     self.assertEqual("1111222334", s.extract_type(input_, int))
Exemplo n.º 17
0
 def test_gopher(self):
     input_ = [('g', 1), ((1, 2), 3), ('op', 1), (3.1415, 1), ('h', 1),
               (False, 1), ('e', 1), ([], 5), ('r', 1)]
     self.assertEqual("gopher", s.extract_type(input_, str))
Exemplo n.º 18
0
 def test_bool(self):
     input_ = [(True, 1), ("and", 1), (False, 1), ('==', 1), (False, 1)]
     self.assertEqual("TrueFalseFalse", s.extract_type(input_, bool))
Exemplo n.º 19
0
 def test_fave(self):
     input = [('r', 1), ('o', 1), (1, 1), ('s', 2), ('o', 1), (5, 0),
              ('n', 1), ('e', 1), (1, 2), ('r', 1), ('o', 1)]
     self.assertEqual("rossonero", s.extract_type(input, str))
Exemplo n.º 20
0
 def test_list_simitli(self):
     input_ = [(['S', 'I', 'M'], 1), (type, 2), (['I'], 1), ({}, 10),
               (['T', 'L', 'I'], 1), ([1, 2, 3, 4], 0), (13, 1)]
     self.assertEqual("['S', 'I', 'M']['I']['T', 'L', 'I']",
                      s.extract_type(input_, list))
Exemplo n.º 21
0
 def test_with_ints_and_floats(self):
     self.assertEqual("42.151.3", s.extract_type(
         [(1, 1), (42.15, 1), (0, 0), (1.3, 1)],
         float))
Exemplo n.º 22
0
 def test_gopher(self):
     input_ = [('g', 1), ((1, 2), 3), ('op', 1), (3.1415, 1),
               ('h', 1), (False, 1), ('e', 1), ([], 5), ('r', 1)]
     self.assertEqual("gopher", s.extract_type(input_, str))
Exemplo n.º 23
0
 def test_america(self):
     input = [('A', 1), ('m', 1), ('e', 1), ('r', 1), ('i', 1),
              (33, 1), (453, 1), (2, 1), ('c', 1), (4, 3),
              ('a', 1), (3, 1)]
     self.assertEqual("America", solution.extract_type(input, str))
Exemplo n.º 24
0
 def test_aalabbalaa(self):
     input_ = [('a', 2), ('l', 1), ('error', 0), ('a', 1), ('b', 2),
               ('a', 1), ('l', 1), ('a', 2)]
     self.assertEqual("aalabbalaa", s.extract_type(input_, str))
Exemplo n.º 25
0
 def test_extract_type_with_string(self):
     self.assertEqual(s.extract_type(self.data, str), 'aizzzzz')
Exemplo n.º 26
0
 def test_fave(self):
     input = [('r', 1), ('o', 1), (1, 1), ('s', 2), ('o', 1), (5, 0),
              ('n', 1), ('e', 1), (1, 2), ('r', 1), ('o', 1)]
     self.assertEqual("rossonero", solution.extract_type(input, str))
Exemplo n.º 27
0
 def test_extract_type_with_list(self):
     self.assertEqual(s.extract_type(self.data, list),
                      '[][][][][1, 2][1, 2][3, 4][3, 4][3, 4]')
Exemplo n.º 28
0
 def test_bg(self):
     input = [('B', 1), ('u', 1), (1, 1), ('l', 1), ('g', 1), ('a', 1),
              ('r', 1), ('i', 1), (1, 2), (4, 3), ('a', 1), (3, 1)]
     self.assertEqual("Bulgaria", solution.extract_type(input, str))
Exemplo n.º 29
0
 def test_extract_type_with_dict(self):
     self.assertEqual(s.extract_type(self.data, dict),
                      "{}{'a': 2}{'a': 2}")
Exemplo n.º 30
0
 def test_num(self):
     input = [('B', 1), ('u', 1), (1, 1), ('l', 1), ('g', 1), ('a', 1),
              ('r', 1), ('i', 1), (1, 2), (4, 3), ('a', 1), (3, 1)]
     self.assertEqual("1114443", solution.extract_type(input, int))
Exemplo n.º 31
0
 def test_int(self):
     input_ = [({
         'a': 10
     }, 1), (1, 4), (0.2, 3), (2, 3), (True, 2), (3, 2), ("something", 1),
               (4, 1), (5, 0)]
     self.assertEqual("1111222334", s.extract_type(input_, int))
Exemplo n.º 32
0
 def test_python(self):
     input = [('p', 1), ('y', 1), ('t', 1), ('h', 1), ('o', 1), ('n', 1)]
     self.assertEqual("python", solution.extract_type(input, str))
Exemplo n.º 33
0
 def test_list_simitli(self):
     input_ = [(['S', 'I', 'M'], 1), (type, 2), (['I'], 1), ({}, 10),
               (['T', 'L', 'I'], 1), ([1, 2, 3, 4], 0), (13, 1)]
     self.assertEqual("['S', 'I', 'M']['I']['T', 'L', 'I']",
                      s.extract_type(input_, list))
Exemplo n.º 34
0
 def test_some_types(self):
     input = [('a', 1), (5, 10), ('p', 2), ('l', 1), ('e', 1), (14, 2)]
     self.assertEqual("apple", solution.extract_type(input, str))
Exemplo n.º 35
0
 def test_aalabbalaa(self):
     input_ = [('a', 2), ('l', 1), ('error', 0), ('a', 1), ('b', 2),
               ('a', 1), ('l', 1), ('a', 2)]
     self.assertEqual("aalabbalaa", s.extract_type(input_, str))
Exemplo n.º 36
0
 def test_extract_type_with_string(self):
     self.assertEqual(s.extract_type(self.data, str), 'aizzzzz')
Exemplo n.º 37
0
 def test_some_types(self):
     input = [('a', 1), (5, 10), ('p', 2),
              ('l', 1), ('e', 1), (14, 2)]
     self.assertEqual("apple", s.extract_type(input, str))
Exemplo n.º 38
0
 def test_extract_type_with_tuple(self):
     self.assertEqual(s.extract_type(self.data, tuple),
                      '(1, 2)(1, 2)(3, 4)(3, 4)(3, 4)()()()')
Exemplo n.º 39
0
 def test_bg(self):
     input = [('B', 1), ('u', 1), (1, 1), ('l', 1), ('g', 1),
              ('a', 1), ('r', 1), ('i', 1), (1, 2), (4, 3),
              ('a', 1), (3, 1)]
     self.assertEqual("Bulgaria", s.extract_type(input, str))
Exemplo n.º 40
0
 def test_extract_type_with_list(self):
     self.assertEqual(s.extract_type(self.data, list),
                      '[][][][][1, 2][1, 2][3, 4][3, 4][3, 4]')
Exemplo n.º 41
0
 def test_string_with_different_types(self):
     fizzbuzz_input = [('f', 1), (5, 10), ('i', 1), (0.3, 100),
                       ('z', 2), ('bu', 1), ('z', 2)]
     self.assertEqual("fizzbuzz", s.extract_type(fizzbuzz_input, str))
Exemplo n.º 42
0
 def test_extract_type_with_set(self):
     self.assertEqual(s.extract_type(self.data, set),
                      'set()set()set()set()set(){1, 2}{1, 2}{1, 2}')
Exemplo n.º 43
0
 def test_with_no_symbols_of_given_type(self):
     self.assertEqual('', s.extract_type([('a', 1), ('b', 1)], int))
Exemplo n.º 44
0
 def test_extract_type_with_dict(self):
     self.assertEqual(s.extract_type(self.data, dict), "{}{'a': 2}{'a': 2}")
Exemplo n.º 45
0
 def test_string_and_list(self):
     fizzbuzz_input = [('f', 1), ([], 0), ('i', 1),
                       ('z', 2), ('bu', 1), ('z', 2)]
     self.assertEqual("fizzbuzz", s.extract_type(fizzbuzz_input, str))
Exemplo n.º 46
0
 def test_cheese(self):
     input = [('c', 1), ('h', 1), (1, 1), ('e', 2), ('s', 1), (5, 0),
              (12, 1), (55, 1), (1, 2), ('e', 1), (1, 1)]
     self.assertEqual("cheese", solution.extract_type(input, str))