Esempio 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))
Esempio 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))
Esempio n. 3
0
 def test_extract_type_with_bool(self):
     self.assertEqual(s.extract_type(self.data, bool),
                      'TrueTrueFalseFalse')
Esempio 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}')
Esempio 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)()()()')
Esempio n. 6
0
 def test_extract_type_with_bool(self):
     self.assertEqual(s.extract_type(self.data, bool), 'TrueTrueFalseFalse')
Esempio n. 7
0
 def test_with_empty_list(self):
     self.assertEqual('', s.extract_type([], type))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio n. 25
0
 def test_extract_type_with_string(self):
     self.assertEqual(s.extract_type(self.data, str), 'aizzzzz')
Esempio 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))
Esempio 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]')
Esempio 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))
Esempio n. 29
0
 def test_extract_type_with_dict(self):
     self.assertEqual(s.extract_type(self.data, dict),
                      "{}{'a': 2}{'a': 2}")
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio 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))
Esempio n. 36
0
 def test_extract_type_with_string(self):
     self.assertEqual(s.extract_type(self.data, str), 'aizzzzz')
Esempio 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))
Esempio 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)()()()')
Esempio 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))
Esempio 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]')
Esempio 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))
Esempio 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}')
Esempio n. 43
0
 def test_with_no_symbols_of_given_type(self):
     self.assertEqual('', s.extract_type([('a', 1), ('b', 1)], int))
Esempio n. 44
0
 def test_extract_type_with_dict(self):
     self.assertEqual(s.extract_type(self.data, dict), "{}{'a': 2}{'a': 2}")
Esempio 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))
Esempio 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))