Beispiel #1
0
 def test_save_event(self, root=''):
     self.event_writer(self.event)
     with open(
             os.path.join(
                 root,
                 string_to_filename(self.event.element.attrib['ivorn'])),
             'r') as f:
         self.assertEqual(f.read(), DUMMY_VOEVENT.decode('utf-8'))
Beispiel #2
0
 def test_characters(self):
     test_data = [
         ("abcd", "abcd"),
         ("1234", "1234"),
         ("1a2b", "1a2b"),
         (".abc", "abc"),
         ("a.bc", "a.bc"),
         ("ab/c", "ab_c"),
         ("a*bc", "abc"),
         ("a||b", "ab"),
         ("a\/b", "a__b")
     ]
     for in_str, out_str in test_data:
         self.assertEqual(string_to_filename(in_str), out_str)
Beispiel #3
0
 def setUp(self):
     self.ivoid = "ivo://test.ivoid/1234#5678"
     with event_file(self.ivoid) as f:
         f.write("Test data")
     self.filename = os.path.join(os.getcwd(),
                                  string_to_filename(self.ivoid))
Beispiel #4
0
 def test_characters(self):
     test_data = [("abcd", "abcd"), ("1234", "1234"), ("1a2b", "1a2b"),
                  (".abc", "abc"), ("a.bc", "a.bc"), ("ab/c", "ab_c"),
                  ("a*bc", "abc"), ("a||b", "ab"), ("a\/b", "a__b")]
     for in_str, out_str in test_data:
         self.assertEqual(string_to_filename(in_str), out_str)
Beispiel #5
0
 def test_save_event(self, root=''):
     self.event_writer(self.event)
     with open(os.path.join(root, string_to_filename(self.event.attrib['ivorn'])), 'r') as f:
         self.assertEqual(f.read(), DUMMY_VOEVENT)
Beispiel #6
0
 def setUp(self):
     self.ivorn = "ivo://test.ivorn/1234#5678"
     with event_file(self.ivorn) as f:
         f.write("Test data")
     self.filename = os.path.join(os.getcwd(), string_to_filename(self.ivorn))