Example #1
0
    def test_recorddao_data_query_all_list_criteria(self):
        """
        Test that the RecordDAO is retrieving on mixed data types.

        Test that we can mix searching on strings, scalars, lists of strings,
        and lists of scalars, using has_all, has_any, and has_only
        """
        no_match = list(
            self.record_dao.data_query(
                val_data_list_1=has_any(DataRange(-10, 8.5),
                                        DataRange(8.9, 25)),  # 5 & 6
                spam_scal_3=DataRange(0, 50),  # 5 only
                val_data_list_2=has_all('eggs', DataRange('o', 'z')),  # 5 & 6
                val_data_3=has_only(0, 9.3)))  # 6 only
        self.assertFalse(no_match)

        just_5 = list(
            self.record_dao.data_query(
                val_data_list_1=has_all(DataRange(-10, 8.5),
                                        DataRange(8.9, 25)),  # 5 & 6
                spam_scal_3=DataRange(0, 50),  # 5 only
                val_data_list_2=has_all('eggs', DataRange('o', 'z')),  # 5 & 6
                val_data_3='sugar'))  # 5 only

        self.assertEqual(len(just_5), 1)
        self.assertEqual(just_5[0], "spam5")
Example #2
0
 def test_recorddao_data_query_string_list_has_all(self):
     """Test that the RecordDAO is retrieving on a has_all list of strings."""
     just_5_and_6 = list(
         self.record_dao.data_query(
             val_data_list_2=has_all('eggs', DataRange('o', 'z'))))  # 5 & 6
     self.assertEqual(len(just_5_and_6), 2)
     self.assertIn("spam5", just_5_and_6)
     self.assertIn("spam6", just_5_and_6)
Example #3
0
 def test_recorddao_data_query_scalar_list_has_all(self):
     """Test that the RecordDAO is retrieving on a has_all list of scalars."""
     just_5_and_6 = list(
         self.record_dao.data_query(val_data_list_1=has_all(
             DataRange(-10, 8.5), DataRange(8.9, 25))))  # 5 & 6
     self.assertEqual(len(just_5_and_6), 2)
     self.assertIn("spam5", just_5_and_6)
     self.assertIn("spam6", just_5_and_6)
Example #4
0
    def test_recorddao_data_query_mixed_list_criteria(self):
        """
        Test that the RecordDAO is retrieving on mixed data criteria.

        Test that we can mix searching on strings, lists of strings, and lists of scalars.
        """
        just_6 = list(
            self.record_dao.data_query(
                val_data_list_2=has_all('eggs', DataRange('o', 'z')),  # 5 & 6
                val_data_list_1=has_any(0, 8),  # 5 & 6
                val_data_3='syrup'))  # 6 only
        self.assertEqual(len(just_6), 1)
        self.assertEqual(just_6[0], "spam6")
Example #5
0
    def test_recorddao_data_query_has_all_mixed(self):
        """
        Test that the RecordDAO is retrieving on mixed data types for has_all.

        Test that we can mix searching on scalars and lists of scalars.
        """
        just_5 = list(
            self.record_dao.data_query(
                val_data_list_1=has_all(DataRange(-10, 8.5),
                                        DataRange(8.9, 25)),  # 5 & 6
                spam_scal_3=DataRange(0, 50)))  # 5 only
        self.assertEqual(len(just_5), 1)
        self.assertEqual(just_5[0], "spam5")