Beispiel #1
0
 def test_drops_attrs_in_list(self):
     self.config[module] = {"attr_list": ["code"]}
     for d in self.data:
         nt.assert_true("code" in d)
     res = list(drop_attributes(self.config, self.data))
     for r in res:
         nt.assert_true("code" not in r)
Beispiel #2
0
 def test_works_when_data_is_a_generator(self):
     self.config[module] = {"attr_list": ["code", "token"]}
     gen_data = (d for d in self.data)
     res = list(drop_attributes(self.config, gen_data))
     nt.assert_equals(len(res), 1)
Beispiel #3
0
 def test_lines_are_deleted_if_empty_dicts(self):
     self.config[module] = {"attr_list": ["code", "token"]}
     res = list(drop_attributes(self.config, self.data))
     nt.assert_equals(len(res), 1)
Beispiel #4
0
 def test_drop_multiple_attrs(self):
     self.config[module] = {"attr_list": ["code", "token"]}
     res = list(drop_attributes(self.config, self.data))
     for r in res:
         nt.assert_true("token" not in r)
         nt.assert_true("code" not in r)
Beispiel #5
0
 def test_doesnt_crash_if_dict_doesnt_have_attr(self):
     self.config[module] = {"attr_list": ["test"]}
     res = list(drop_attributes(self.config, self.data))
     for r in res:
         nt.assert_true("test" not in r)
Beispiel #6
0
 def test_only_drops_attrs_in_list(self):
     self.config[module] = {"attr_list": ["code"]}
     res = list(drop_attributes(self.config, self.data))
     for r in res:
         nt.assert_true("token" in r)
Beispiel #7
0
 def test_doesnt_drop_attrs_by_default(self):
     res = list(drop_attributes(self.config, self.data))
     nt.assert_equals(res, self.data)