Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit tests for empty #O0 & P0 control lines #227

Merged
merged 4 commits into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 0 additions & 12 deletions .pydevproject
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>


<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">


<path>/${PROJECT_DIR_NAME}</path>


</pydev_pathproperty>


<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>


<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">bluesky</pydev_property>


</pydev_project>
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
Change History
##############

:1.1.12: expected *2019-08-16* :
:1.1.13: expected *2019-08-16* : enhancements, bug fix, rename

* `#224 <https://github.com/prjemian/spec2nexus/issues/224>`_
rename: list_recent_scans --> catalog
* `#222 <https://github.com/prjemian/spec2nexus/issues/222>`_
writer: add empty #O0 and #P0 lines
* `#220 <https://github.com/prjemian/spec2nexus/issues/220>`_
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ jsonschema>3
ophyd
pandas
pyRestTable
spec2nexus
spec2nexus>=2021.1.2
xlrd
25 changes: 7 additions & 18 deletions tests/test_filewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,29 +119,18 @@ def test_writer_default_name(self):
self.assertIn("108", scans)
scan = sdf.getScan(108)
self.assertEqual(scan.N[0], len(scan.L))

self.assertGreater(scan.header.raw.find("\n#O0 \n"), 0)
self.assertGreater(scan.header.raw.find("\n#o0 \n"), 0)

# see: https://github.com/prjemian/spec2nexus/issues/196
# tests/test_plugin.py test_empty_positioner()
self.assertEqual(len(scan.header.O), 1)
self.assertEqual(scan.header.O[0], [''])
self.assertEqual(len(scan.header.O[0]), 0)
self.assertEqual(len(scan.header.o), 1)
self.assertEqual(len(scan.header.o[0]), 0)

self.assertGreater(scan.raw.find("\n#P0 \n"), 0)
self.assertEqual(len(scan.P), 1)
self.assertEqual(scan.P[0], '')

# TODO: after next spec2nexus release
# self.assertGreater(scan.header.raw.find("\n#O0 \n"), 0)
# self.assertGreater(scan.header.raw.find("\n#o0 \n"), 0)
# self.assertEqual(len(scan.header.O), 1)
# self.assertEqual(len(scan.header.O[0]), 0)
# self.assertEqual(len(scan.header.o), 1)
# self.assertEqual(len(scan.header.o[0]), 0)
# self.assertGreater(scan.raw.find("\n#P0 \n"), 0)
# self.assertEqual(len(scan.P), 1)
# self.assertEqual(len(scan.P[0]), 0)
# self.assertEqual(len(scan.positioner), 0)
self.assertEqual(len(scan.P[0]), 0)
self.assertEqual(len(scan.positioner), 0)

def test_writer_filename(self):
self.assertTrue(len(self.db) > 0, "test data ready")
Expand Down