示例#1
0
 def test_width_diff(self):
     t1 = create_table(['a', 'b'])
     t2 = create_table(['a', 'b', 'c'])
     try:
         t1 + t2
         self.fail()
     except TypeError as e:
         self.assertEqual(str(e),
                          "Width of the tables are different: 2 != 3")
示例#2
0
 def test_column_types_diff(self):
     t1 = create_table(['a', 'b'], [ValueType(), ConditionType()])
     t2 = create_table(['a', 'b'], [ValueType(), StringType()])
     try:
         t1 + t2
         self.fail()
     except TypeError as e:
         self.assertEqual(str(e),
                          ('Column types of the tables are different: '
                           '(value, condition) != (value, string)'))
示例#3
0
 def test_labels_diff(self):
     t1 = create_table(['a', 'b'])
     t2 = create_table(['a', 'c'])
     try:
         t1 + t2
         self.fail()
     except TypeError as e:
         self.assertEqual(
             str(e),
             "Labels of the tables are different: ('a', 'b') != ('a', 'c')")
示例#4
0
 def test_two_key_two_value2(self):
     tb = create_table(['keyA', 'keyB'])
     tb._insert(['value1A', 'value1B'])
     tb._insert(['value2A', 'value2B'])
     self.assertEqual(tb.select(keyB='value1B'), ('value1A', 'value1B'))
     self.assertEqual(tb.select(keyB='value2B'), ('value2A', 'value2B'))
示例#5
0
 def test_one_key_two_value(self):
     tb = create_table(['key'])
     tb._insert(['value1'])
     tb._insert(['value2'])
     self.assertEqual(tb.select(key='value1'), ('value1', ))
     self.assertEqual(tb.select(key='value2'), ('value2', ))
示例#6
0
 def test_one_key_no_value(self):
     tb = create_table(['key'])
     self.assertRaises(LookupError, lambda: tb.select(key='value'))
示例#7
0
 def test_labels(self):
     tb = create_table(['keyA', 'keyB', 'keyC'])
     self.assertEqual(tb._labels, ('keyA', 'keyB', 'keyC'))